semicolong after for() loop stackoverflow

#include <stdio.h>

int main() {
    for (int i = 0; i < 5; i++)
        printf("%d ", i);

    return 0;
}

Explanation:

  1. The main function is the entry point of the program.

  2. Inside the main function, a for loop is used. The loop initializes the variable i to 0, checks if i is less than 5, and increments i by 1 after each iteration.

  3. The loop body contains a printf statement that prints the current value of i followed by a space.

  4. The loop will execute five times (for i values 0 to 4), printing the values 0, 1, 2, 3, and 4.

  5. After the for loop, the main function returns 0, indicating successful execution of the program.