Mega Code Archive

 
Categories / C / Code Snippets
 

Two dimensional char array and for loop

#include <stdio.h> int main(void) { char text[][80] = { "2", "4", "6", "8", "10", "12", "14", "" }; 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; }