What should be the output of the program and why??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

15th Jan 2020, 7:27 AM
Prakhar
4 Answers
15th Jan 2020, 8:51 AM
Ipang
+ 1
Sorry bro.. I am unable to understand... What that is... Please tell me where I am wrong..
15th Jan 2020, 9:34 AM
Prakhar
+ 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.
15th Jan 2020, 9:38 AM
Ipang
+ 1
Thanks bro.... Thanks a lot.. ..
15th Jan 2020, 9:54 AM
Prakhar