I'm at the beginning of this wonderful and powerful language! according to deitel & deitel, for a program that sums two integers you can either write the sum in one instruction and then display the result in another instruction like this:
sum = integer1 + integer2;
printf( "Sum is %d\n", sum );
or you can calculate the sum directly in the printf function and display it all in the same:
printf( "Sum is %d\n", integer1 + integer2 );
My doubt/questions:
I understand the first instruction where the = operator assigns the value of integer1 plus integer2 to the variable sum and the next instruction displays the value of the variable sum but I don't get the last instruction where the sum is done inside printf because in this case there is no value assigned to sum and there is no variable sum used.
I wonder: in the last instruction does %d automatically take the value of integer1 + integer2 and it skips the variable sum? How does it work in this instruction without actually using the variable sum? also what is the name/use of %d?