So im having trouble with pointers and strings. Im writing a program that asks a user to input a string then should count the string. I can do that but it also wants us to write a function that returns an integer and accepts a pointer to a C string as an argument. Any help would be appreciated. This is what I have
it also wants us to write a function that returns an integer and accepts a pointer to a C string as an argument.
Inside the function, just convert the C-style string to a normal string (you can even do this by calling your existing count function), and when calling the function take your normal strings and use .c_str() on them.