H
harry
Hi All
I have the following C code:
#include "stdio.h"
int main()
{
int *piArr,iVal,i;
piArr=(int*)malloc(sizeof(int)*5);
for(i=0;i<5;i++)piArr=i;
iVal=*(++piArr) + *(++piArr);
printf("%d,%d",iVal,*piArr);
piArr-=2;
delete(piArr);
return 0;
}
Result (MS VC compiler): 4,2
Result (gcc) : 3,2
Which one is correct? Or is the behaviour not defined by C standard
and hence is compiler specifc?
Thanks and regards
Harry
I have the following C code:
#include "stdio.h"
int main()
{
int *piArr,iVal,i;
piArr=(int*)malloc(sizeof(int)*5);
for(i=0;i<5;i++)piArr=i;
iVal=*(++piArr) + *(++piArr);
printf("%d,%d",iVal,*piArr);
piArr-=2;
delete(piArr);
return 0;
}
Result (MS VC compiler): 4,2
Result (gcc) : 3,2
Which one is correct? Or is the behaviour not defined by C standard
and hence is compiler specifc?
Thanks and regards
Harry