string size is equal to number of characters
I was making a basic program of strings and did this. there is a string
int this way
#include<stdio.h>
int main()
{
char str[7]="network";
printf("%s",str);
return 0;
}
It prints network.In my view it should not print network or some garbage
value should be printed because '\0' does not end this character array. So
how it got printed?there were no warning or errors too.
No comments:
Post a Comment