c - using nested printf statements giving strange output -
I recently came to this code and I am unable to understand how it works
is included in #lt; stdio.h & gt; Integer main () {printf ("line 1 \ n", printf ("line 2 \ n", printf ("line 3 \ n", printf ("row 4 \ n", 0)))); Return 0; }
This is giving the following output:
line 4 line 3 line 2 line 1
is used to print the formatted line. For example, to print an integer, you call:
printf ("% d", 1);
What you did, the argument to call the return value of Nest print
is that it needs to first be nested call evaluation, which means that Is in. Your call is the same:
int temp; Temp = printf ("line 4 \ n", 0); Temp = printf ("line 3 \ n", floating); Temp = printf ("line 2 \ n", floating); Temp = printf ("line 1 \ n", floating); Also, note that since you have a format specifier in the format string, then there is no meaning for the second argument, and if your compiler is quite good then it is also more that. Will warn about.
Comments
Post a Comment