And of course nothing is going to be printfed, since the first char itself 
shows end of string.
 
Bala

--- On Wed, 7/23/08, Bala <[EMAIL PROTECTED]> wrote:

From: Bala <[EMAIL PROTECTED]>
Subject: Re: [c-prog] printf
To: [email protected]
Date: Wednesday, July 23, 2008, 9:16 AM







>the printf( ) function does not take into account of this while returning the
>number of characters in the array.

Just would like to add here 
"\0" char indicate end of an array
And anyting after "\0" in printf will be ignored while calculating no. of chars.
 
printf("\0 Hi All");
 
will return zero.
 
 
Regards,
Bala 
 
 

--- On Wed, 7/23/08, Thomas Hruska <[EMAIL PROTECTED]> wrote:

From: Thomas Hruska <[EMAIL PROTECTED]>
Subject: Re: [c-prog] printf
To: [email protected]
Date: Wednesday, July 23, 2008, 7:00 AM

Raj jyotee DuttaPhookan wrote:
> Hi Bill, thats true that '\0' is invisibly stored at the end
of an array in C which often helps to know the end of the array. But I think
the printf( ) function does not take into account of this while returning the
number of characters in the array. Once I removed \n from the string, it
was correctly returning 11.

It was correctly returning 12 before as well.  Computers obey every 
single instruction with perfect obedience - even if some instruction 
causes an application crash, the computer will even execute the crash 
perfectly since that is clearly what you wanted it to do.

The computer is hereby the perfect wife/husband that everyone is looking 
for.  Cheap too.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/


------------------------------------

To unsubscribe, send a blank message to
<mailto:[EMAIL PROTECTED]>.Yahoo! Groups Links





      

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

Reply via email to