Is this your company?
Given a two dimensional array of characters, provide an implementation which would print out the characters in the array in a spiral manner.
Anonymous
void printSpiralArray() { int a[5][5] = { {1,2,3,4,5}, {6,7,8,9,10}, {11,12,13,14,15}, {16,17,18,19,20}, {21,22,23,24,25} }; int i = 0, j = 0, k = 0; printf("Original array\n"); for (i = 0; i = 0) { printf("%d ", *(a[i] + k)); k--; } printf("\n"); } else { for (j = 0; j < 5; j++) { printf("%d ", a[i][j]); } printf("\n"); k = j - 1; } } }
Check out your Company Bowl for anonymous work chats.