I recently came across this code and I\'m unable to understand how it works
#include
int main(){
printf(\"Line 1\\n\",
printf(\"Line 2\\n\
printf is used to print a formatted line. For example, to print an integer, you call:
printf( "%d", 1 );
What you did, is call it with the return value of the nested print
as argument, which means that it first need to evaluate the nested call. Your call is similar to:
int temp;
temp = printf("Line 4\n", 0);
temp = printf("Line 3\n", temp);
temp = printf("Line 2\n", temp);
temp = printf("Line 1\n", temp);
Also, note that since you have no format specifiers in the format string, there is no meaning to the second argument, and if your compiler is nice enough it will even warn you about that.