I have a function with the signature
char * processString(const char * const string);
This function is passed a constant pointer to a constant string defined in main()
int main(void) {
myString[] = "Hello";
char * ptr = processString(myString);
}
Inside processString() I want to iterate over each character, but I am stuck at grabbing the first character from this const pointer to const string.
I read this somehow related post (among others) c syntax passing const pointer to const data to function
I tried initializing a second pointer to read each character of the string one by one
char * processString(const char * const string) {
char * pointer = &string;
return pointer;
Your help is very much appreciated!