Sollicitatievraag bij MathWorks

What is a null pointer?

Antwoorden op sollicitatievragen

Anoniem

12 jun 2011

Definition: A null pointer is a general pointer (int *i, char *c, etc..,) except that the address stored in i, c doesn't correspond to any memory location. (i=0, c=0)

1

Anoniem

20 apr 2015

NULL is "Pointing to nothing" It can be referenced as 0 or NULL or nil. The RHS will decide the value If the RHS is pointer then 0 is pointing to nothing, and if RHS is not pointer e.g. integer the 0 has integer 0 value. so NULL is actually defined by the compiler/library designer and it has to be type cast to other types when we assigned it to different datatype values. NULL has no datatype of its own. [void != NULL]

Anoniem

22 mrt 2016

On most of the operating systems, programs are not permitted to access memory at address 0 because that memory is reserved by the operating system. However, the memory address 0 has special significance; it signals that the pointer is not intended to point to an accessible memory location. But by convention, if a pointer contains the null (zero) value, it is assumed to point to nothing.

Anoniem

14 mei 2011

I guess what the interview want to hear is that "do not forget to release the memory the pointer pointed to before set it to null"

Anoniem

12 jun 2011

Once the memory is release using the delete command, the pointer is pointing to null. Now if we try to delete it again, the heap will be corrupt.

Anoniem

20 apr 2011

A pointer that points to nowhere or an empty location.

1