If I initialized variable like this:
static int i = 2 * 2 / 0;
Then, compiler give me an error.
prog.c: In function 'main':
prog.c:5:23: warning: division by zero [-Wdiv-by-zero]
static int i = 2 * 2 / 0;
^
prog.c:5:17: error: initializer element is not constant
static int i = 2 * 2 / 0;
But, If I use || instead of *, like this:
static int i = 2 || 2 / 0;
then it's successfully compiled.
According to Operator Precedence, Precedence of * higher than ||. So, first 2 / 0 operation evaluated. Am I right?
So, why doesn't static int i = 2 || 2 / 0; give an error?