I am trying to write a program that takes user-input strings and prints them out as a 7 by 5 asterisk grid. I am currently trying to figure out how to print put the letters as I need to print them line by line in order for the different letters to be printed side by side.
Anyway, my attempt so far is this:
#include <stdio.h>
#include <string.h>
char capitalA[7][5] = {
" * ",
" * * ",
"* *",
"*****",
"* *",
"* *",
"* *"
};
int i;
int j;
int main()
{//main
for (i = 0; i < 5 ; i++)
{
for (j = 0; j < 7 ; j++)
{
printf("%s\n", capitalA[j][i]);
}
}
return (0);
}//*main
My desired output is the asterisk A, but I get a Segmentation fault.