Printf ("%d" ,printf {"tim") ); 1. results in a syntax error 2. outputs tim 3 3. outputs garbage 4. prints tim and terminates abruptly

Questions by Rujul   answers by Rujul

Showing Answers 1 - 11 of 11 Answers

Edwin

  • Mar 16th, 2007
 

Ans 2. 

  Was this answer useful?  Yes

saravanaraja

  • Mar 16th, 2007
 






Syntax error.

  Was this answer useful?  Yes

gaurav_gangwar9

  • Mar 17th, 2007
 

syntax error

  Was this answer useful?  Yes

vnmurali

  • Mar 30th, 2007
 

1. Result in a syntax error.

  Was this answer useful?  Yes

Vishwas.p

  • Feb 8th, 2008
 

Well yes it gives out a syntax error for the above code..

But if it was like this : printf("%d",printf("tim"));

Result : tim3

This is because printf function always returns the number of characters printed...

  Was this answer useful?  Yes

monuavi26

  • Mar 20th, 2009
 

The Answer is 2. printf function returns the number of characters printed, so it returns 3 and "tim" is already printed due to the call to printf("tim"). So the output is tim 3.

  Was this answer useful?  Yes

alok

  • Sep 11th, 2011
 

Syntax error
but if it is: printf("%d",printf("tim"));
then output is: tim3

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions