+ 1
Why the answer is 3 ??
char a[20]; int x; x = strlen(a); printf("%d",x); O/P- 3
3 Answers
+ 2
You haven't written any letters into the string, you have only reserved the space for it.
So what's in there, is totally unpredictable (and by extension the result of any string-related function as well).
+ 2
Thanks man
0
HonFu [#GoGetThatBugChamp!]
In some other thread there was a similar situation were a n Ă n array was accessed outside its boundaries and always retuned Null. That lead me to the assumption that all C code is run in debug mode and all array are initially set Null during compilation.
Wrong guess?
Cheers.C