I don't get it
Posted: September 18th, 2014, 11:59 pm
Hey Guys,
i am watching the intermediate at the moment after i paused some month and i came to a Question you will probably all laugh about... (first of all sry for my bad English...).
The thing is if you have this program (Intermediate Lesson 3):
This has the Output:
1
6
I expected:
6
6
My Problem is, I don't understand why the function main() is called before SetA()... Is it because SetA() is called in main() or why...
I look forward to read your answers
i am watching the intermediate at the moment after i paused some month and i came to a Question you will probably all laugh about... (first of all sry for my bad English...).
The thing is if you have this program (Intermediate Lesson 3):
Code: Select all
#include <stdio.h>
int a=1;
void SetA()
{
a = 6;
}
void dispA()
{
printf("%d\n",a);
}
void main()
{
printf("%d\n",a);
SetA();
dispA();
}
1
6
I expected:
6
6
My Problem is, I don't understand why the function main() is called before SetA()... Is it because SetA() is called in main() or why...
I look forward to read your answers