Question: Consider the following code: voidp=malloc(1000) This call to malloc may fail if the system cannot locate a block of unused memory that is as large

 Consider the following code: voidp=malloc(1000) This call to malloc may fail

Consider the following code: voidp=malloc(1000) This call to malloc may fail if the system cannot locate a block of unused memory that is as large as requested. How can the program know if this malloc has failed? malloc return 1 there is no way for the program to determine if malloc failed. malloc prints a statement of failure to stdout malloc returns NULL malloc throws an OutOfMemoryException

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!