Your code has at least 3 problems.
First, and most relevant to your specific question, you declared the argument to your function as one character: char . To pass the string C, declare the argument as char * - a character pointer is a type also used for string C:
void invert(char *str)
And you do not need to play when passing an argument:
invert(str);
Also note that you typed the function name incorrectly in the function prototype: you named it inverti there. The name in the prototype must match the name in the function definition later in the code.
You will also need to change the type of the argument in the revised and renamed function prototype:
void invert(char *str);
There is another problem in your code: you repeat the line using SIZE . SIZE is the maximum size of your array, but not necessarily the size of your string: what if the user enters only 5 characters? You must view and use the strlen function to get the actual length, and in your loop, only iterate over the actual length of the string.
source share