you didn't put an '\0' at the end of the string
strlen looks for a '\0' in the string and here it happened to be 8
bytes after the starting position of s

On 6/15/10, mohit ranjan <[email protected]> wrote:
> Hi All,
>
> char s[]={'a', 'b', 'c', 'd'};
>
> printf("%d\n", strlen(s));
>
>
> o/p is 8
>
> can anybody plz explain why 8 ?
>
> Mohit
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to