How bout the new-line character??
Correct me if i am wrong...
 Ankit M Shah
Ph: 916-832-2950.



----- Original Message ----
From: Raj jyotee DuttaPhookan <[EMAIL PROTECTED]>
To: [email protected]
Sent: Tuesday, July 22, 2008 9:57:52 PM
Subject: Re: [c-prog] printf


As I can count, "Hello world" has 11 characters including the gap between 
"Hello" and "world". But why does it return 12 characters?

Paul Herring <pauljherring@ gmail.com> wrote: On Tue, Jul 22, 2008 at 12:19 PM, 
kathir resh <resh_personal@ yahoo.co. in> wrote:
> since printf is a function it returns the no of characters it prints..how to 
> view how much it
> returns instead of using nested printf

Store the return value in an int, and use a subsequent printf to 'view' it:

int i = printf("Hello world\n");
printf("Characters printed: %d\n", i);

-- 
PJH

'Two Dead in Baghdad' not 'product-friendly' - Kent Ertugrul, chief
executive of Phorm.

http://shabbleland. myminicity. com

[Non-text portions of this message have been removed]

 

[Non-text portions of this message have been removed]

Reply via email to