print 2-dimensional array
Hello!
I'm familarized with Matlab/scilab and other labs programing. So, I've got some dificults to manipulate Array in C.
I need to use in C a instruction which compute, i.e.
Code:
matrix_display(2,:)
But I read in C we need to access all rows and columns.
So I write this code to "see" a print of array, but output is garbage
Code:
#include <stdio.h>
#include <stdlib.h>
#define row_size 10
#define column_size 7
int matrix_display [row_size] [column_size]={
{1,1,1,1,1,1,0},//0
{0,1,1,0,0,0,0},//1
{1,1,0,1,1,0,1},//2
{1,1,1,1,0,0,1},//3
{0,1,1,0,0,1,1},//4
{1,0,1,1,0,1,1},//5
{0,0,1,1,1,1,1},//6
{1,1,1,0,0,0,0},//7
{1,1,1,1,1,1,1},//8
{1,1,1,0,0,1,1},//9
};
int main()
{
int i,j;
for(i=0;i<row_size;i++)
{
for(j=0;j<column_size;j++)
printf(" %d\n", matrix_display[i,j]);
}
}
Where is my mistake?
Is there a simple way to print all columns which correspond at 1 row?
Thank you :)
And sorry, this is a rookie question :)