What is the difference between null pointer and void pointer

Answers were Sorted based on User's Feedback



What is the difference between null pointer and void pointer..

Answer / vignesh1988i

NULL POINTER :
the pointer which dosent point to any memory location is
called NULL POINTER.

VOID POINTER :
the pointer is a one which can only point to a particular
memory location of it's own type.... but when the pointer
is given void it can be mde to point any location of
different type

Is This Answer Correct ?    134 Yes 13 No

What is the difference between null pointer and void pointer..

Answer / abi

Yes there are differences between a null pointer and a void
pointer. As you know that a pointer holds the memory address
of any variable . So we can say for a null pointer that :

- A null pointer can be of any primitive type(e.g - int *
,char * etc)

-However a null pointer does not point to any memory
location , i.e. it does not contain a reference of any
variable/value. Hence we may state that it has a NULL as its
value making it a null pointer.

Where as in case of a void pointer we can say :

- void pointer is always of type void *

- Mainly such pointers are used for dynamic memory
allocations (using malloc(), calloc() and realloc()
functions) , where memory block reserved is pointer to by a
void pointer and as the pointer value is returned it has to
be explicitly type casted to a particular desired type.

for e.g

int * ptr;

ptr=(int *) malloc(sizeof(int));

[ Here malloc () returns a pointer of void * type(i.e a void
pointer) which is type casted to int * as per our requirement ]

Is This Answer Correct ?    15 Yes 1 No

What is the difference between null pointer and void pointer..

Answer / govind

a void pointer is a special type of pointer of void and
denotes that it can point to any type of data type .NULL
pointer can take any pointer type , but do not point to any
valid reference or memory adderss.it is important to note
that a NULL pointer is different from a pointer that is
initialized.

Is This Answer Correct ?    19 Yes 8 No

What is the difference between null pointer and void pointer..

Answer / lakhpat

A Void pointer is a special type of pointer of void and
denotes that it can point to any data type. NULL pointers
can take any pointer type, but do not point to any valid
reference or memory address. It is important to note that a
NULL pointer is different from a pointer that is not
initialized.

Is This Answer Correct ?    12 Yes 1 No

What is the difference between null pointer and void pointer..

Answer / xlnx

NULL POINTER WILL POINT TO NOTHING.BUT VOID POINTER POINTNG
TO ANY OTHER DATA TYPE OF POINTER.

Is This Answer Correct ?    14 Yes 4 No

What is the difference between null pointer and void pointer..

Answer / siva prasad

A null pointer is a value. It is a special reserved value used to indicate that the pointer is not pointing to anything conceptually.
A void pointer is a type of pointer, void* . It is used to indicate that the storage location pointed to by the pointer has no specific type.

Is This Answer Correct ?    0 Yes 0 No

What is the difference between null pointer and void pointer..

Answer / nagarala sai deepak reddy

NULL POINTER :
the pointer which dosent point to any memory location is
called NULL POINTER.

VOID POINTER :
the pointer is a one which can only point to a particular
memory location of it's own type.... but when the pointer
is given void it can be mde to point any location of
different type

Is This Answer Correct ?    0 Yes 0 No

What is the difference between null pointer and void pointer..

Answer / gokul saravanan

Null pointers returns null value and void pointer returns no
value

Is This Answer Correct ?    38 Yes 39 No

What is the difference between null pointer and void pointer..

Answer / ksm st

null pointer doesn't points the any memory location but void pointer points the memory location of different type.
void pointer returns no value but null pointer returns the null value.

Is This Answer Correct ?    1 Yes 4 No

What is the difference between null pointer and void pointer..

Answer / junejo

what is except handling in c sharp?

Is This Answer Correct ?    5 Yes 17 No

Post New Answer

More C Interview Questions

what are bit fields in c?

0 Answers  


What is the difference between typedef struct and struct?

0 Answers  


a program that can input number of records and can view it again the record

0 Answers   Accenture,


How to add two numbers without using semicolon n c????

3 Answers  


Dont ansi function prototypes render lint obsolete?

0 Answers  






What has to put when we are inserting as assembly language code into the C code? or When we are inserting as assembly language code into the C code we have to insert one thing at the start and of the assembly language. What are they?

2 Answers  


the question is that what you have been doing all these periods (one year gap)

0 Answers   HCL,


What are all different types of pointers in c?

0 Answers  


if array a conatins 'n' elements and array b conatins 'n-1' elements.array b has all element which are present in array a but one element is missing in array b. find that element.

18 Answers   Parexel, Ram Infotech, Zycus Infotech,


Why does the call char scanf work?

0 Answers  


int *a[5] refers to

12 Answers   TCS,


What is a nested loop?

0 Answers  


Categories