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.

Bill Cunningham <[EMAIL PROTECTED]> wrote:          
----- Original Message ----- 
From: "Ankit Shah" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, July 23, 2008 2:12 AM
Subject: Re: [c-prog] printf

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?

In C there is a null terminated string character. C doesn't have strings 
but a char * indicates pointer to a string. Strelen is returning the value 
of '\0' which is at the end of every string invisibily stored.

Bill



                           

       

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

Reply via email to