# Thread: Help printing out two arrays

1. ## Help printing out two arrays

//I want to know to print out two array colums. For example,

char list_ch[][2]={'1','a',
'2','b',
'3', 'c',
'4', 'd',
'5', 'e',
'6', 'f'};

//I want to print them out in two colums

//please tell me the easiest way, I am just beginning to C.

2. int i;
for(i=0;i<6;i++)
printf("%c\t\t%c",list_ch[i][0],list_ch[i][1]);

3. What does this mean?
list_ch[i][0],list_ch[i][1]);

4. "i" is the loop variable that allows you to access the values in the array.

Like:

Code:
```array[10];
int k;

for(k = 0; k < 10; k++)
{
array[k] = k;   //<--"k" is at  "4" on the fifth go-around
//....................// So if I assign the VALUE of "k" to the value in the
//...................// array, then array[4] ==4 !
}

for(k = 0; k < 10; k++)
{
printf("%i", array[k]);   // <--See for yourself
}```

5. ## Arrays

Ok I understand that the loops, but I mean what do the list_ch[i][0],list_ch[i][1]); mean you know how it has a zero right next to the "i".

6. In C the array indexing starts from 0.
FOr eg.,
if you declare
int a[10];
since the array starts from 0 the elements are
a[0],..............,a[9]any code containing a[10] might crash.
but If I am not mistaken it is legal to assign a pointer one past the end of a array
int a[10];
int p;p=a+10; /*probably legal*/
*p;/*illegal*/

7. I meant
int a[10];
int *p;
p=a+10;/*probably legal*/
*p;/*illegal*/