jeudi 7 juillet 2016

How to add elements of an array with themselves?


I want to add an element of an array with itself. Here is some of my code :

for (j = 0; j <= N - 1; ++j) {
    Phi[j] = Randf();
    G_0[j] = 0;
} ...
...
for (l = 0; l = N - 1; ++l) {
    G_0[l] += Phi[l] * Phi[l];
}

But compiler yields this error :

Error   C2114   '+=': pointer on left; needs integral value on right

I don't know what to do. I've researched this type of error but either I cannot find anything useful or I'm so clueless that I don't understand what I've found.

How can I add an element of an array with itself? Thanks in advance.


Aucun commentaire:

Enregistrer un commentaire