Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define MAX_BUFFER_CAP 1024
- #include <stdio.h>
- #include <stdlib.h>
- #include <conio.h>
- int main(void)
- {
- char (*names)[MAX_BUFFER_CAP] = NULL;
- int size, i;
- clrscr();
- printf("How many names do you want to store? ");
- scanf("%d", &size);
- fflush(stdin);
- names = malloc(size * sizeof(char*));
- for(i = 0; i < size; i++)
- {
- printf("Enter name %d: ", i+1);
- gets(names[i]);
- }
- printf("The names are\n");
- for(i = 0; i < size; i++)
- {
- printf("%s\n", names[i]);
- }
- free(names);
- getch();
- return 0;
- }
Add Comment
Please, Sign In to add comment