I read that I can put the main()function wherever I want in my C program and that if I create other functions in my program, main() will always execute first.
What I don't understand then is how the following code works. If the program starts executing the main()function, how can we reference something (integer_test) that has not been read yet?
------------------------------------------------
#include <stdio.h>
int integer_test(int a, int b)
{
int total;
total = a + b;
return total;
}
int main()
sum = integer_test(2,14);
printf("The addition of 2 and 14 is %d\n", sum);
return 0;
}
-----------------------------------------------------
What I don't understand then is how the following code works. If the program starts executing the main()function, how can we reference something (integer_test) that has not been read yet?
------------------------------------------------
#include <stdio.h>
int integer_test(int a, int b)
{
int total;
total = a + b;
return total;
}
int main()
sum = integer_test(2,14);
printf("The addition of 2 and 14 is %d\n", sum);
return 0;
}
-----------------------------------------------------