This depends upon the implementation. Hence, your program is not
portable. It's allowed to return NULL, and it's allowed to return a non-NULL
pointer. Both ways are sanctioned by the Standard.

On Wed, Jun 8, 2011 at 4:20 PM, coder dumca <[email protected]> wrote:

> can any one tell me why this code perfectly running and giving ouput 56
>
> int main()
> {
> int *p=malloc(0);
> *p=56;
> printf("%d",*p);
> return 0;
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Harshal Choudhary,
III Year B.Tech CSE,
NIT Surathkal, Karnataka, India.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to