|
|||||||||||
|
Technical Support Support Resources
Product Information |
C51: Null Pointer Compare Fails With MALLOC and CALLOCInformation in this article applies to:
QUESTIONThe pointer NULL comparison in the following code never becomes true. However, the loop should allocate all available memory.
Is there a mistake in my code? ANSWERThe malloc function returns a memory specific pointer to xdata. When you convert the pointer to a generic pointer, the pointer value is 0x10000. Therefore, this is not a NULL pointer anymore. When you define the pointer as a memory typed pointer, the code works:
SEE ALSOLast Reviewed: Thursday, February 25, 2021 | ||||||||||
|
|||||||||||
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.