This was given to me and i'm supposed to figure out what gets printed out...Code:void addOne(); // function prototype int x = 10; int y = 20; int main() { int x = 5; addOne(); printf ("x=%d, y=%d", x, y); } void addOne() { x++; y++; }
I've been trying to decipher this code... to me it looks like the variables are set at 10 and 20...
but x=5 would be static and y=20 from the addOne() ??
How does the counter work x++ and y++??



LinkBack URL
About LinkBacks


