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 <[EMAIL PROTECTED]> wrote:          On Tue, Jul 22, 2008 at 12:19 
PM, kathir resh <[EMAIL PROTECTED]> 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]

Reply via email to