#include <stdio.h>
int main() {
int n, i;
char arr[20];
clrscr();
printf("Enter size of array(<=20)");
scanf("%d", &n);
printf("Enter array");
for (i = 0; i < n; i++) {
scanf("%s", &arr[i]);
}
for (i = 0; i < n; i++) {
printf("%s", arr[i]);
}
getch();
return 0;
}
The program does not prints the array and instead shows Program termination message
char arr[20];does not mean an array of 20 strings, with each string being big enough to hold the entire text of "Harry Potter And The Sorcerer's Stone". You cannot expect to be able to enter the entire text of each Harry Potter book in response to "Enter Array", and have it fit inside yourchar arr[20];. C does not work this way.