I just ran into some code that overuse semicolons, or use semicolon for different purposes that I am not aware of.

I found semicolons at the end of if-statements and at the end of functions. For instance:

int main (int argc, char * argv[]) {
    // some code

    if (x == NULL) {
        // some code
    };  <-----

    // more code

    return 0;
}; <---

It is compiling with cc, not gcc. What do those semicolons do? I'm assuming that there is no difference because the compiler would just consider it as empty statement.

c
Edit
Report