#include <stdio.h>
#include <stdlib.h>
const int NUMBER_OF_LETTERS_IN_WORD = 50;
int main()
{
int numberOfWords;
printf("Enter number of words:");
scanf("%d",&numberOfWords);
char *words[numberOfWords];
printf("Enter words:\n");
int i;
for(i = 0; i < numberOfWords; i++){
words[i] = malloc(NUMBER_OF_LETTERS_IN_WORD*sizeof(char));
scanf("%s",words[i]);
}
printf("\nOutput:\n\n");
for(i = 0; i < numberOfWords; i++){
printf("%s\n", words[i]);
}
free(words);
return 0;
}
Comments
Leave a comment