it's 11.

i think you juste write out of the  a[] array, so '\0', can be at a[4], or a[7] 
etc... and strlen can change. (the output of this program is 11 for me).



________________________________
De : Shantanu Sachdev <shantanumn...@gmail.com>
À : algogeeks@googlegroups.com
Envoyé le : Mercredi 27 Juillet 2011 16h08
Objet : [algogeeks] Xplain the C code



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