I want to put the data in array using scanf as below with int value.
int main (){
int size=5;
int marks[size];
int x;
for(x=0; x<size; x++){
scanf("%d", &marks[x]);
}
for(x=0; x<size; x++){
printf("The Element at %d is %d\n", x, marks[x]);
}
getch();
return 0;
}
Above code is fine and working but i want to use same with strings array like below example, but its not working.
int main (){
int size=5;
char *name[size];
int x;
for(x=0; x<size; x++){
scanf("%s", name[x]);
}
for(x=0; x<size; x++){
printf("The Element at %s is %s\n", x, name[x]);
}
getch();
return 0;
}