Ben Ben - 7 months ago 42
Vb.net Question

What does j+= (i=j) mean in C++

I have virtually no experience in programming C. But now i have to use a bit of C code in a VB.net application.

Translating the code has been succesful so far, but i have encountered this weird (at least for me) statement

j += ( i = j);


both j and i are integers. I have been looking on this forum and Google but found no answer about what it might mean.

A bit further in the C code I have some similar code that looks like

chisq += (temp = y[i] - (aa + bb*x[i]), temp*temp);


all variables except for i are double or an array of doubles.

Please excuse me if I made some grammar or spelling mistakes.

Thanks in advance.

Answer

It firsts assigns j to i, and then adds i to j.

Like this:

i = j;
j += i;
Comments