That is because you have exceeded the character array size so i think it is
providing unwanted results.
To correct the program increase the size of the array a a[9] .


On Wed, Jul 27, 2011 at 9:38 PM, Shantanu Sachdev
<[email protected]>wrote:

>
> #include<stdio.h>
> #include<string.h>
> int main()
> {
>         char a[3]="mnnitald";
>         int x=strlen(a);
>         printf("%d",x);
> }
>
> Plz xplain the output of this program. x comes out to be 7. if  u take
> a[2],den it comes to be 6 nd so on.and if a[7] is taken, size comes out to
> be 10.
>  Compiler - GCC.
> --
> SHANTANU SACHDEV
> 20098080
> MNNIT ALLAHABAD
>
>  --
> 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.
>



-- 
Regards
Rajeev N B <http://www.opensourcemania.co.cc>

-- 
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