I am stuck on one part of an assignment. Among other things, we have to get a character string of random length from a user and then reverse and output that string. In order to do this, I need to be able to call my string length function inside of my print backwards function, but I cannot figure out how to do it. I cannot change the function definitions.
char *c is a pointer to character. It gives you the current character at that particular location of memory. Every string in c++ is terminated by "\0"(null) character. Using char* you can read the characters till you reach "\0". Increment a counter during this process. When you reach the null character you should have the string length in the counter. Hope this helps