while((*gets(buffer) !='\n') && (i<8))
{
pS[i]=(char *)malloc(strlen(buffer)+1);

if(pS[i]==NULL)                            /* Check for no memory allocated */
{
      printf("Memory allocation failed.Program terminated.\n");
      return;
}
strcpy(pS[i++],buffer);


}