#include
int main ()
{
char *ptr = \"stackoverflow\"
}
Is there any way to find the length of stackoverflow pointed by ptr, a
The strlen() function provided by string.h gives you how many "real characters" the string pointed by the argument contains. However, this length does not include the terminating null character '\0'; you have to consider it if you need the length to allocate memory.
That 4 bytes is the size of a pointer to char on your platform.