#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef char* string;
int main(void)
{
    char *names[6];
    int num_entries = 0,i=0,size=0;
    string name = (string) malloc(sizeof(char) * 16);
    printf("\nHow many names do you want to enter ? \n");
    scanf("%d",&num_entries);
    for(i=0 ; i < num_entries ; i++)
    {
        printf("\nEnter a name : ");
        gets(name);
        size = strlen(name);
        names[i] = (string) malloc(sizeof(char)*size + 1);
        strcpy(names[i],name);
    }
    for(i=0 ; i < num_entries ; i++)
        puts(names[i]);
}
in this program the string is not read the first time around the loop,however works fine for all subsequent calls,the program simply has to accept n strings,store and display them. owever it executes n-1 times.Solution?also,feel free to point any mistakes in the way pointers,allocation etc. is used,any feedback appreciated .
 
     
     
     
    