Q:

Printing out arrays based on user input in C

I am trying to write a program in which the user inputs text and the console prints that text in a 7 by 5 grid of asterisks.
e.g;
Enter a word:
a

**** 
    *
*****
*   *
*****

However I am having trouble identifying the characters and then letting the program know.
My attempt so far:
#include <stdio.h>
#include <string.h>

char a[7][6] = { 
"     ",
"     ",
"**** ",
"    *",
"*****",
"*   *",
"*****"
};

...other letters... 

char word[20];
int i;
int j;
char letter[2];

int main() {//main

fgets(word, sizeof(word), stdin);

for (j = 0; j < strlen(word); j++) {
strcpy(letter, word[j]);
    for (i = 0; i < 7 ; i++) {
        printf("%s %d\n", letter[i]);
    }
}

printf("Total number of characters processed: %d\n", strlen(word) - 1);

return (0);
}//*main

Letters are made in an individual array and printed line by line via loop in order for them to be printed one after the other horizontally.
My best idea was that variable letter which would change value to the current character being read from word but I know it is not correct.

A:

This is a working example that prints a whole word in asterisk form (comments through the code):
#include <stdio.h>
#include <stdlib.h>

#define maxchar 10      // number of characters in asterisk form
#define maxrows 6               // vertical length 
#define maxcols 5               // horizontal length
#define imax    5               // number of chars to be displayed in asterisk form

int main()
{
  // testing word with spaces
  char number[imax] = "92 02";

  // array of numbers
  char letter[maxrows][maxchar][maxcols] = 
    { //  j=0 ,    j=1 ,    j=2 ,    j=3 ,    j=4 ,    j=5 ,    j=6 ,    j=7 ,    j=8 ,    j=9
      { " ** ",  "*** ",  "*** ",  "*** ",  "*  *",  "****",  "*   ",  "****",  " ** ",  " ***" },  // row=0
      { "*  *",  "  * ",  "   *",  "   *",  "*  *",  "*   ",  "*   ",  "   *",  "*  *",  "*  *" },  // row=1
      { "*  *",  "  * ",  "   *",  " ** ",  "****",  "*** ",  "*** ",  "   *",  " ** ",  "*  *" },  // row=2
      { "*  *",  "  * ",  "*** ",  "   *",  "   *",  "   *",  "*  *",  "   *",  "*  *",  " ***" },  // row=3
      { "*  *",  "  * ",  "*   ",  "   *",  "   *",  "   *",  "*  *",  "   *",  "*  *",  "   *" },  // row=4
      { " ** ",  "****",  "****",  "*** ",  "   *",  "*** ",  "*** ",  "   *",  " ** ",  "   *" }   // row=5
    };

  // "iterators"
  int row, col, i;

  for(row=0; row < maxrows; ++row) // print from up to down
    {
      for(i=0; i < imax; ++i)      // for each character in array "number"
        {
          int j = number[i] - '0'; // get position in "letter". For characters, change to  j = number[i] - 'a';

          if(j<0) 
            printf("    ");        // if number[i] is not a valid character, print a space   
          else
            for(col = 0; col < maxcols; ++col)    
              printf("%c", letter[row][j][col]);   // print each * at given row

          printf("  ");            // print a small space between characters
        }
      printf("\n");                // proceed to next row
    }

  return 0;
}

Although I used numbers instead of characters, minimal changes would fit your needs. For this code, number[] = "92 02" will be printed as:
  ***  ***          **   ***   
 *  *     *        *  *     *  
 *  *     *        *  *     *  
  ***  ***         *  *  ***   
    *  *           *  *  *     
    *  ****         **   ****

