char* call()
{
int k=3,h=0;
char *str[3];
//Where are you allocating the memory to store strings?
for(h=0;h<k;h++)
{
printf("Enter the String");
//Allocate memory here
scanf("%s",str+h);
}
return *str;
}
int main()
{
int i=3,j=0;
char name[i][20];
name[0]=call();
//The only name[0] gets the address of pointer here. NOT the name[1] and
name[2];
for(j=0;j<i;j++)
{
printf("The string %d",j);
//This is wrong...
printf("%s\n",name+j);
}
return 0;
}
--
Regards
Sumit Chawla ("eNetra : Hail the Invention")
"Computers are useless. They can only give you answers.":Pablo Picasso
[Non-text portions of this message have been removed]