+ 1
What should be the output of the program and why???
According to me it should not be 4 because the block has size 0 bytes.... How it can store 4... https://code.sololearn.com/cgc6ligT861s/?ref=app
4 ответов
+ 5
Read about zero sized malloc request below.
http://c-faq.com/ansi/malloc0.html
https://pubs.opengroup.org/onlinepubs/009695399/functions/malloc.html
+ 1
Sorry bro.. I am unable to understand... What that is... Please tell me where I am wrong..
+ 1
You can find the answer for your doubt in the first link in my previous response. Did you read my response bro?
(Edit)
Simply said, what we get from a memory handle returned by malloc depends on how the compiler was designed to handle such situation (malloc request with zero size specified). What we get in one compiler may differ to what we get from another compiler(s). Requesting zero sized memory allocation is illogical, might as well not to make the request at all.
+ 1
Thanks bro.... Thanks a lot.. ..