hello guys!
i have a problem (don't know why) and need some help
I have a matrix se part of the code below
but i get a run time error when i have the last statement matrix[i/3][i%3]=' ';Code:int i, j; char matrix[3][3]; for(i=0;i<=9; i++) { if(bo->square[i].piece_type==1) /*bo->square[i].piece_type return an integer */ matrix[i/3][i%3]='+'; else if (bo->square[i].piece_type==2) / matrix[i/3][i%3]='*'; else matrix[i/3][i%3]=' '; }
(Run-Time Check Failure #2 - Stack around the variable 'matrix' was corrupted.)
If a remove this statement everything is correct but i get some strange (random character) at the empty matrix element when i print it on the screen
Can somebody tell me how do i intialize an element of the matrix with an empty character ' ' without geting this error ?



LinkBack URL
About LinkBacks



