How to get the max index of a char* object

Yes, strings would be better but I need to use a char* object. How would I get the maximum index of it? Not the index of the spaces with data in it but the maximum index that it can go up to. This char* array is changing. I could pass the value out from another function, but I rather not.
Last edited on
Unless you're in the scope where the character array was defined, you have no way of knowing the sizeof() the character array. You should be passing the size of the array along with the array to any function that requires that information.

Yes, strings would be better but I need to use a char* object.

Why must you use a character array?

Topic archived. No new replies allowed.