for (int i = 0; n = strlen(argv[1]); i < n; i++)
        if (isdigit(argv[1][i]))
            return 0;
            printf("Usage: ./caesar key\n");
            return 1;

The error happens in the first line of the code shown. It says to "place parentheses around the assignment" although I've never had to do that before. I've also used many for loops like this (But not using argv) and I've never had this issue. And even when i try to put parentheses in all types of configurations, it just results in more and more errors. Thank you for your help!

2 Answers 2


The for statement has too many semicolons.

See: i keep seeing this line underlined with an error that says "using the result of an assignment as a condition without parentheses"

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

  • Okay, but then i get the error "non-void function does not return a value in all control paths [-Werror,-Wreturn-type]"
    – Harr
    Apr 22, 2023 at 22:57
  • 1
    That's an unrelated problem. The compiler found a path that can result in no return value. If you can't figure it out, please post a new question with the entire function.
    – Cliff B
    Apr 23, 2023 at 0:05

The line

for (int i = 0; n = strlen(argv[1]); i < n; i++)

should probably be:

for (int i = 0, n = strlen(argv[1]); i < n; i++)

In other words, you probably need to change a ; to a ,.

A for statement consists of three parts:

  1. the initialization (which may also include a declaration)
  2. the condition expression, which is evaluated before every loop iteration and will determine whether the loop should continue for another iteration
  3. the iteration expression, which is executed after every loop iteration and is commonly used for incrementing the loop counter

All three parts of the for statement must be separated by a ;, so every for statement must contain exactly two ;. Since your for statement contains three ;, you are violating the syntax rules of the language, which is why the compiler is complaining.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .