nested printf

S

soorajk007

Hi friends,

Can u plz tell me why
printf("%d",printf(" Hello World "));
prints Hello World13.
Please explain the concept in detail.

Thanks
Sooraj
 
B

Bill Pursell

Hi friends,

Can u plz tell me why
printf("%d",printf(" Hello World "));
prints Hello World13.
Please explain the concept in detail.
From the man page for printf:
Upon successful return, these functions return the number of
characters printed ...

The inner printf printf " Hello World " and returns the number of
characters printed, namely 13. The outer printf then prints "13".
 
V

void * clvrmnky()

Can u plz tell me why
printf("%d",printf(" Hello World "));
prints Hello World13.
Please explain the concept in detail.
Didn't someone asked this very question in this newsgroup recently? I
recall because I had never seen this construct before, though the answer
did not surprise me in the least.
 
S

SM Ryan

(e-mail address removed) wrote:
# Hi friends,
#
# Can u plz tell me why
# printf("%d",printf(" Hello World "));
# prints Hello World13.
# Please explain the concept in detail.

Lisp serialisation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,183
Messages
2,570,966
Members
47,515
Latest member
Harvey7327

Latest Threads

Top