-
multi-dimensional array
Hello,
In this code:
Code:
/* void main(void)
{
int i,j;
int array[3][3]={' ', '*', ' ',
'*', ' ', '*',
' ', '*', ' '};
for(i=0; i<3; i++)
{
for(j=0; j<3; j++)
{
printf("%i", array[i][j]);
}
printf("\n");
}
} */
I thought that it would print a design such as this;
*
* *
*
but in comes out this;
32 43 32
43 32 43
32 43 32
What am i doing wrong? Thanks, Mcorn
-
Change the %i in the printf() function to %c. That should work.
-
Thank you very much! It's amazing how one little piece of code can be overlooked! Once again thanks!