I'm working on a program that rotates text based on a cipher value, but I'm running into an error: 'expected identifier' on line 31 when defining my `rotate` function. Here's the relevant section of my code:
```c
string rotate(plain_text, int cipher)
```
The issue seems to be that I'm not specifying the type for `plain_text`. I'm using `cs50.h` for the `string` type. How should I properly define the parameters for my function, and is there anything else I should be aware of?
3 Answers
Yeah, it looks like you just missed defining the type for `plain_text`. Just change your `rotate` function definition to `string rotate(string plain_text, int cipher)`, and you should be good! Also, don't forget that `main` should end with a `return 0;` statement to properly terminate.
Looks like you didn’t define `plain_text` as a string in your function. It should be declared like this: `string rotate(string plain_text, int cipher)`. You'll also want to make sure your `main` function returns `0` at the end. About the `string` type, yeah, it’s from `cs50.h`—just keep an eye on those details!
You're right about needing to define the type of `plain_text` in the function declaration. It should look like this: `string rotate(string plain_text, int cipher)`. Also, make sure your `main` function returns `0` at the end to signify that it ran successfully. As for the function declaration, `int main(int argc, string argv[1])` is unconventional; it's usually written as `int main(int argc, char **argv)` unless `cs50.h` provides an alternative for `string`. Just check the documentation for `cs50.h`!
Thanks for clarifying that! I wasn't sure about the `string` type, but it makes sense that it would come from the `cs50.h` library.