/*….Hey guy’s this is the program reffered to the post i have posted i.e “CALL BY REFERENCE…”
/*…HOPE YOU LIKE IT….*/
#include <stdio.h>
void cubeByReference( int * ); /* prototype */
void cubeByReference( int * ); /* prototype */
/*…Main Function Starts…*/
void main()
void main()
{
int number = 5; /* Initialising….*/
printf( “The original value of number is %d”, number );
int number = 5; /* Initialising….*/
printf( “The original value of number is %d”, number );
/*….Calling of Function…with arguments in it..*/
cubeByReference( &number );
printf( “\nThe new value of number is %d\n”, number );
getch();
}
cubeByReference( &number );
printf( “\nThe new value of number is %d\n”, number );
getch();
}
/*…Main Function Ends..*/
/*…Function Definition Starts..*/
void cubeByReference( int *nPtr )
void cubeByReference( int *nPtr )
{
*nPtr = *nPtr * *nPtr * *nPtr; /* cube number in main */
}
*nPtr = *nPtr * *nPtr * *nPtr; /* cube number in main */
}
/*….Function Definition Ends..*/
No comments:
Post a Comment