Why we need null pointer?

Page 1

Why we need null pointer? Pointers allow you to refer to the same space in memory from multiple locations. They need because there are so many advantages: 

To dynamic allocate in your memory.

This means that you can update memory in one location and the change can be seen from another location in your program. You will also save space by being able to share components in your data structures.

You should use pointers any place where you need to obtain and pass around the address to a specific spot in memory. You can also use pointers to navigate arrays:

In some cases, function pointers are required to use functions that are in a shared library (.DLL or .so). This includes performing stuff across languages, where oftentimes a DLL interface is provided.


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.