Code:
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv)
{
char array[9][10][20] =
{
{" ### "," "," ### "," ### "," "," ### "," ### "," ### "," ### "," ### "},
{"# #"," #"," #"," #","# #","# ","# "," #","# #","# #"},
{"# #"," #"," #"," #","# #","# ","# "," #","# #","# #"},
{"# #"," #"," #"," #","# #","# ","# "," #","# #","# #"},
{" "," "," ### "," ### "," ### "," ### "," ### "," "," ### "," ### "},
{"# #"," #","# "," #"," #"," #","# #"," #","# #"," #"},
{"# #"," #","# "," #"," #"," #","# #"," #","# #"," #"},
{"# #"," #","# "," #"," #"," #","# #"," #","# #"," #"},
{" ### "," "," ### "," ### "," "," ### "," ### "," "," ### "," ### "},
},
*nr = argv[1];
unsigned int i = 0, h = 0, idx = 0;
if(argc > 2)
{
char dispChar = argv[2][0];
for( i = 0; i < 9; i++)
{
for(h = 0; h < 20; h++)
{
for(idx = 0; idx < strlen(array[i][h]); idx++)
{
if(array[i][h][idx] != ' ')
array[i][h][idx] = dispChar;
}
}
}
}
for( i = 0; i < 9; i++)
{
for(h = 0; h < strlen(nr); h++)
if(nr[h] != ' ')
printf(" %s ", array[i][nr[h] - 0x30]);
putchar('\n');
}
return 0;
}
3-dimensional array. What it does should be obvious, but how it does it might not be.