What Will be the Output of the following C Program

Every programmer is familiar to the function printf(); but there is also many things, everybody dons know.

Let’s Try to Predict the output of the program ►►

void main()
   int a=101;

Can you guess the output ?? If yes then congrats.

The output of the above program will be 10131.

That’s because the printf() function returns the number of characters it printed. And we know the associativity of the function is from right to left. So first the right one printf() will print the value of C, which is 101, then the function will return the value 3, because it printed the three characters or say the digits and then will return the value 1 and it will get print from the last printf() function.

That’s why the output is 10131.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s