Scanf function changes value of in-loop variable
Capture_A_Lag
bla at bla.bla
Wed Apr 16 10:47:03 PDT 2014
Hi all!
I have this code:
------------------------------------------------------------------------------
ubyte N, M, K;
ubyte[][max][max] Matrix;
scanf("%d %d %d", &N, &M, &K);
ubyte tmp;
for(ubyte n = 1; n <= N; n++)
for(ubyte m = 1; m <= M; m++)
{
scanf("%d", &tmp);
// After this scanf n becomes 0 for no reason
if(tmp) Matrix[m][tmp] ~= n;
}
------------------------------------------------------------------------------
After scanf in loop variable n becomes 0. Is this a bug? Please
help me!
More information about the Digitalmars-d-learn
mailing list