7213709-C-Programming

Page 42

{ add (1,4); } /*******************************************/ add (a,b) int a,b; { printf ("%d", a+b); }

When this program is run, two new variables are automatically created by the language, called a and b. The value 1 is copied into a and the value 4 is copied into b. Obviously if a and b were given new values in the function add() then this could not change the values 1 and 4 in main(), because 1 is always 1 and 4 is always 4. They are constants.

However if instead the program had been: main () { int a = 1, b = 4; add (a,b); } /**************************************/


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.