Example for how to use strlen in c:
What is the output of below c program?
char ch = "skill gun technologies";
char *p = ch;
printf("%d %d",strlen(p), sizeof(p));
strlen returns the length of string excluding '\0' . So it will be 22. sizeof of a pointer will be always the size of the address, which will be mostly 4 bytes in most of the systems. so it prints 22, 4.
Back To Top