[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
HI please tell what could be the problem
the following code simple "C" code giving correct result on
Windows(Microsoft c compiler).
Where as in the case of Linux I am not getting first string.
Please can any one explain me the problem??
Thanks
void main()
{
char **p=NULL;
p=(char**)malloc(sizeof(char*));
doublealloc(p);
for(int i=0; i<5; i++)
{
printf("%s\n",p[i]);
}
}
void doublealloc(char **p)
{
int i=0;
for(i=0;i<5; i++)
{
p[i]=(char*)malloc(64);
strcpy(p[i],"Kondaiah");
}
}
________________________________Honeywell
Kondaiah Dasari
Honeywell India Software Operation Pvt Ltd
19/4, Venkataswamy Naidu Road
Tasker Town, Bangalore - 560051, INDIA
Ph : 91-80-2860357
Fax : 91-80-2860356
Email :kondaiah@xxxxxxxxxxxxx