@Revertron @rayslava gcc will output a warning;
main.c:6:26: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=]
6 | printf("Number: %d\n"), number;
| ~^
| |
| int
What that line does is calls printf without any argument (which won't cause a crash, as whatever garbage is in memory or in the register will print out) and then writes the value of number to nowhere (gcc will optimize that null operation out if optimizations are enabled).
The x,x; operator is a way to execute 2 or more operations in one line, for example;
printf("Number: %d\n", number), ++number, printf("Number incremented: %d\n", number);
Although you would really write; printf("Number: %d\n", number), printf("Number incremented: %d\n", ++number);
Or actually; printf("Number: %d\nNumber incremented: %d\n", number++, number);
main.c:6:26: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=]
6 | printf("Number: %d\n"), number;
| ~^
| |
| int
What that line does is calls printf without any argument (which won't cause a crash, as whatever garbage is in memory or in the register will print out) and then writes the value of number to nowhere (gcc will optimize that null operation out if optimizations are enabled).
The x,x; operator is a way to execute 2 or more operations in one line, for example;
printf("Number: %d\n", number), ++number, printf("Number incremented: %d\n", number);
Although you would really write; printf("Number: %d\n", number), printf("Number incremented: %d\n", ++number);
Or actually; printf("Number: %d\nNumber incremented: %d\n", number++, number);