There is no way in C/C++ that I know of. I use the first element of the array to hold the number of elements (like in turbo pascal with strings : string holds length). If you are using char, then it will limit you to 255 elements.
This works fine in Borland C++ 5.02. You can also try using list, vector, etc.
void doSomething(char *cptr)
int numElements = cptr;
for (int i = 1; i <= numElements; i++)
cout << "Element " << i << " = " << cptr[i] << endl;
char teststring = "this is some text";
int len = strlen(teststring);
char * temp = new char[len + 1];
temp = len;