I know the answer to the following problem is 17, but I need someone to explain the process to me.
What will be the contents of a[0] after the execution of the following code:
int a[5];
for (int j=0; j<5; j++)
a[j] = 3*j - 1;
for (j=3; j>=0; j--)
a[j] = a[j+1] + j;
Can anyone help? I assumed the answer to be -1 because 3*0-1=-1
I am learning c++ completely online.
What am I missing?
Thanks
Last edited on