#include int main () { char *ptr = \"stackoverflow\" }
Is there any way to find the length of stackoverflow pointed by ptr, a
Purely using pointers you can use pointer arithmetic:
int strLen(char *s) { int *p = s; while(*p !=’\0’) { p++; /* increase the address until the end */ } Return p – s; /* Subtract the two addresses, end - start */ }