#include
#include
int main()
{
int *p;
printf("Hello world!\n");
p = malloc(0);
*p = 1000000;
printf("%d %d\n",p,(int)*p);
free(p);
return 0;
}
ఈ program correct గా పనిచేస్తుంది
#include
int main()
{
int *p;
printf("Hello world!\n");
p = malloc(0);
*p = 1000000;
printf("%d %d\n",p,(int)*p);
free(p);
return 0;
}
ఈ program correct గా పనిచేస్తుంది
See C99, section 7.20.3:
ReplyDeleteIf the size of the space requested is zero, the behavior is implementationdefined: either a null pointer is returned, or the behavior is as if the size were some nonzero value, except that the returned pointer shall not be used to access an object.