Learning the program and had a quick question that they didn't explain. This code works fine I am just understanding it a little better.
#import <stdio.h>
int main(int argc, char *argv[])
{
int value1, value2, sum;
value1 = 50;
value2 = 25;
sum = value1 + value2;
printf ("the sum of %i and %i is %i\n", value1, value2, sum);
return 0;
}
NOW in the printf line they use 3 %i. I know those are the integers for the 3 I set up. My question is how do they know which ones they are? In the MAIN I establish 3 integers VALUE1, VALUE2, SUM. Is it using those in the order that I write them or is it taking them from the second part of the PRINTF line where I have them separated by a comma?
In short, I am trying to understand how each %i knows which integer it is assigned to? I hope that is a clear explanation.
Thanks,
-Lars
#import <stdio.h>
int main(int argc, char *argv[])
{
int value1, value2, sum;
value1 = 50;
value2 = 25;
sum = value1 + value2;
printf ("the sum of %i and %i is %i\n", value1, value2, sum);
return 0;
}
NOW in the printf line they use 3 %i. I know those are the integers for the 3 I set up. My question is how do they know which ones they are? In the MAIN I establish 3 integers VALUE1, VALUE2, SUM. Is it using those in the order that I write them or is it taking them from the second part of the PRINTF line where I have them separated by a comma?
In short, I am trying to understand how each %i knows which integer it is assigned to? I hope that is a clear explanation.
Thanks,
-Lars