I am having difficulty passing strings between functions in C. Here is the most simplified parts of my code that contain the errors: First, the function prototype for transpose, which performs a certain unary operation on strings. I've heard we declare strings with char *str, so this is correct?
char *transpose(*char);
//[Error] expected primary-expression before 'char'
Here is the use of the transpose function in main(). I indicated which lines produce errors with the following comment.
int main() {
char *input;
scanf("%s",&input);
char *result;
result = transpose(input);
//[Error] 'transpose' cannot be used as a function
printf("%s",result);
return 0;
Finally is the function definition for transpose:
char *transpose(char *text) {
char *T = text;
return T;
}