MathWorks Interview Question: What is a null pointer?... | Glassdoor

Interview Question

Applications Support Engineering Interview Natick, MA

What is a null pointer?

Answer

Interview Answer

6 Answers

1

A pointer that points to nowhere or an empty location.

Interview Candidate on Apr 20, 2011
0

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"

Anonymous on May 14, 2011
0

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.

Anonymous on Jun 12, 2011
0

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)

Anonymous on Jun 12, 2011
0

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]

Anonymous on Apr 20, 2015
0

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.

Anonymous on Mar 22, 2016

Add Answers or Comments

To comment on this, Sign In or Sign Up.