Either there is a bug in the IDE or something is wrong in my understanding of C++.
A part of a loop(where i<6) in my code is:
int R=r;
int I=i;
int ans;
if(I>5)
cerr<<“Error0…”<< I <<"-"<< i << endl;
ans=simulateDrop(mygrid,newgrid,blocks,I,R);
if(I>5)
cerr<<“Error1…”<< I <<"-"<< i << endl;
The function declaration is:
int simulateDrop(char gridi[12][6], char gridf[12][6], char blocks[2], int col, int rot);
Here ‘col’ is called by value.
It works fine sometimes but sometimes it shows errors.
An instance of the error stream shows as follows:
Error1…52-3
Error1…52-2
Error1…52-3
Error1…52-4
Error1…52-3
Error1…52-2
Error1…52-3
Error1…52-4
It remains the same even if i is passed as argument instead of I.
I is not equal to i and there is no line with Error0 while there is Error1. How is it possible? Please explain if I am wrong.