C array assignment and indexing with similar variable.
Posted
by Todd R.
on Stack Overflow
See other posts from Stack Overflow
or by Todd R.
Published on 2010-03-16T03:40:07Z
Indexed on
2010/03/16
5:36 UTC
Read the original article
Hit count: 302
Hello! I apologize if this has been posted before. Compiling under two separate compilers, BCC 5.5 and LCC, yields 0 and 1.
#include <stdio.h>
int main(void)
{
int i = 0, array[2] = {0, 0};
array[i] = ++i;
printf("%d\n", array[1]);
}
Am I to assume not all compilers evaluate expressions within an array from right to left?
© Stack Overflow or respective owner