arrays - Abort trap 6 error in C -


I have this code:

  Invalid DrawinelAnim (Int number 1, int no 2 , Int number 3) {int board [2] [50]; Make an array with // 3 columns int i; // i, j, k loop counters are int j Int k; For (i = 0; i & lt; num1 + 1; i ++) // fill the array with rocks, or 'o' board [0] [i] = 'o'; // For example, if num1 is 5, then fill the first row in 5 rocks for the board 5 (i = 0; i & lt; num2 + 1; i ++) [1] [i] = 'O' ; For (i = 0; i  

When I compile it with GCC, then it's OK. When I run the file, I get the error abort trap 6 after entering the values.

I have looked at other posts about this error, and they do not help me. Try it out:

Try it:

  Invalid Drawnational Anime (int no 1, Int number 2, int number 3) {int board [3] [50] = {0}; // This is a local variable, it is not possible to use it after returning from this function. Int i, j, k; For (i = 0; i & lt; num1; i ++) board [0] [i] = 'o'; For (i = 0; i & lt; num2; i ++) board [1] [i] = 'o'; For (i = 0; i & lt; num3; i ++) board [2] [i] = 'o'; For (j = 0; j & lt; 3; j ++) {for (k = 0; k & lt; 50; k ++) {if (board [j] [k]! = 0) printf "% C", board [j] [k]); } Printf ("\ n"); }}  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -