Why do these programs work, and why do I not get a "semicolon missing" error? With this question I want to ask about when I can skip semicolons. As far as I know semicolon is sentence terminator. Is it correct to write these type of statements where we use comma instead of semicolon? In program1 there's a negation then printing and then getchar() in one line without semicolon and using comma. Similarly in program 2, there's negation, assignment, printf and getchar() all used. How much line we can write using comma and not using semicolon?
program1:
#include <stdio.h>
int main()
{
int i = 0xAA;
~i, printf("%X\n", i),getchar();
return 0;
}
program 2:
#include <stdio.h>
int main()
{
int i = 0xAA;
i=~i, printf("%X\n", i),getchar();
return 0;
}