collect string in loop and printout all the string outside loop
- by user1508163
I'm newbie here and there is some question that I want have some lesson from you guys.
For example:
#include <stdio.h>
#include<stdlib.h>
#include<ctype.h>
void main()
{
char name[51],selection;
do
{
printf("Enter name: ");
fflush(stdin);
gets(name);
printf("Enter another name?(Y/N)");
scanf("%c",&selection);
selection=toupper(selection);
}while (selection=='Y');
//I want to printout the entered name here but dunno the coding
printf("END\n");
system("pause");
}
As I know when the loops perform will overwrite the variable then how I perform a coding that will printout all the name user entered?
I have already ask my tutor and he is ask me to use pointer, can anyone guide me in this case?