Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C11 > FIOC

Name: Anonymous 2012-06-08 3:42

The following is valid C11 code.
You jelly FIOCfags?


#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv){
    int a, b;

    if(argc < 3){
        fprintf(stderr, "Usage: %s n1 n2\n", argv[0]);
        return 1;
    }

    a = atoi(argv[1]);
    b = atoi(argv[2]);

    a, b = b, a;

    printf("%d, %d\n", a, b);

    return 0;
}

Name: Anonymous 2012-06-08 6:26

>>3,4
No, comma has the highest precedence, so "(a, b = b, a)" does nothing with a, assigns the value of b to b, returns a. C11 is backward-compatible and can't change anything here.

>>5 they always worked magically, why?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List