I'm suppose to use a multidimensional array to print out a list of names from the scanf() can someone show me what to do because I've tried a bunch of times and I get weird output heres some code:
Code:
#include <stdio.h>
#include <stdlib.h>
#define i 30
int main()
{
int x;
char iName[i] = {'\0'};
int iChoice = 0;
while(iChoice != 3)
{
system("cls");
printf("\n1\tEnter a name");
printf("\n2\tPrint Report");
printf("\n3\tQuit");
printf("\n\n\tEnter a Choice: ");
scanf("%d", &iChoice);
if(iChoice == 1)
{
system("cls");
printf("\n\tEnter a name: ");
scanf("%s", iName);
}
else if(iChoice ==2)
{
break;
}
else if(iChoice == 3)
break;
}
system("cls");
for(x=0;x<=2;x++)
printf("%s\n",iName[x]);
}
I'm not using a multidimensional array in this example but I couldn't even get it to work with a one dimensional array