For a char [], I can easily get its length by:
char a[] = \"aaaaa\";
int length = sizeof(a)/sizeof(char); // length=6
However,
There are only two ways:
If the memory pointer to by your char * represents a C string (that is, it contains characters that have a 0-byte to mark its end), you can use strlen(a).
Otherwise, you need to store the length somewhere. Actually, the pointer only points to one char. But we can treat it as if it points to the first element of an array. Since the "length" of that array isn't known you need to store that information somewhere.