Hi,
I am writing a code where I need a 11 cross 11 matrix (M) with all the elements zero, except
M[5][5] = 1. I wrote the following code
Code:#include<stdio.h> main() { int i,j; int M[10][10]; for(i=0;i<=10;i++) { for(j=0;j<=10;j++) { M[i][j]=0; } } M[5][5] = 1; }
The problem is that the last line, M[5][5]=1 changes the all the elements in the 6th column to 1. I want only the 6th element in the 6th column to be 1. Can somebody tell me how to correct this mistake ?
Thanks,
banny



LinkBack URL
About LinkBacks



