Two dimensional char array and for loop
#include <stdio.h>
int main(void)
{
char text[][80] = {
"1", "2", "3",
"4", "5", "6",
"7", ""
};
int i, j;
/* now, display them */
for(i = 0; text[ i ][ 0 ]; i++) {
for(j = 0; text[ i ][ j ]; j++)
printf("%c", text[ i ][ j ]);
printf(" ");
}
return 0;
}
Related examples in the same category