#include int main(int argc, char *argv[]) { char s[]=\"help\"; printf(\"%d\",strlen(s)); }
Why the above output is 4, isn
strlen: Returns the length of the given byte string not including null terminator;
strlen
char s[]="help"; strlen(s) should return 4.
sizeof: Returns the length of the given byte string, include null terminator;
sizeof
char s[]="help"; sizeof(s) should return 5.