For string, C appends '\0' internally. hence sizeof(str) returned the value
3.
str1 is char array with two character. hence sizeof(str1) returned the
value 2.

--  RK :)


On Sat, Oct 6, 2012 at 5:53 PM, rahul sharma <rahul23111...@gmail.com>wrote:

> char str[]="ab";
> char str1[]={'a','b'};
>
> sizeof(str) ...o/p is 3
> sizeof(str1)....o/p is 2..
>
> Why so????
> plz explain...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to