문제

I have the curiosity to know the behaviour, in C, of a multidimensional array increased as below:

int x[10][10];

y = x[++i, ++j];

I know that is the wrong way. I just want to know what the compiler do in this case and what will be the consequence if a programmer do this in his code.

도움이 되었습니까?

해결책

That is the comma operator, misused. ++i, ++j yields the value of j + 1 and has 2 side effects (modifying i and j). The whole thing basically means ++i; y = x[++j]. Which will work or not, depending on the type of y.

what will be the consequence if a programmer do this in his code

Well, most likely other programmers will give him/her murderous looks.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top