I am having trouble with the basic principles of strings in C. I have a function:
char *editStr(char *str) {
char new[strlen(str)];
... do some editing ...
return new;
}
How would I return the array of characters called "new". As I understand, the return value of the function is a char*, which means that it is asking for a pointer to the first character of a string. Right now, I guess the problem is that I am returning a character of arrays. I tried to return a pointer to the first character in "new", but that doesn't seem to work, either. I tried "return *new[0]". My string knowledge is bad.