|
|
|
|
The low level operators (reference operator & and de-reference operator *) will be discussed later !!!
void update( double a ) // a is passed by value { printf( "Inside update - before changing a, a = %lf\n", a); a = a + 1; printf( "Inside update - AFTER changing a, a = %lf\n", a); } int main( int argc, char* argv[] ) { double a = 3.14; printf( "Inside main - before calling update(a), a = %lf\n", a); update ( a ); printf( "Inside main - AFTER calling update(a), a = %lf\n", a); } |
Result:
Inside main - before calling update(a), a = 3.140000 Inside update - before changing a, a = 3.140000 Inside update - AFTER changing a, a = 4.140000 Inside main - AFTER calling update(a), a = 3.140000 Unchanged !!! |
How to run the program:
|
Explanation:
|