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

Which is more efficient, a switch statement or an if else chain?

0 Answers  


Why does everyone say not to use scanf? What should I use instead?

0 Answers  


main difference between c and c++ language

1 Answers  


Can a program have two main functions?

0 Answers  


why do we use # in c-language?

1 Answers  






A set of N billiard balls are set on a one-dimensional table. The table is 1 meter long, set north-south with two pockets at either side. Each ball has zero width and there is no friction so it is moving with a fixed velocity of either northward or southward and bounces back in a perfect elastic collision from other balls it encounter on its way (or drop into one of the pockets). Your job is to keep track of the balls movements. Task Please write a program that gets the initial place, speed and direction of all the balls and gives the position of a specific ball after t seconds. Input The first line contains the number of scenarios. Each one of the other lines in the input contains a scenario: The first number, N, is the number of balls; followed by N pairs of numbers: the distance in centimeters from the south end of the table and the speed (positive speed meaning it moves northward); the last two numbers are the number i of the target ball you should track and the time T in seconds. Output The output is a single number for each line which is the place (distance in centimeters from the south end of the table) of the tracked ball after T seconds. Note: There is no new line character at the end of the result. Sample Input 5 1 50 1 1 1000 1 50 1 1 6 1 60 -2 1 6 2 10 1 95 -1 2 30 2 10 1 95 -1 2 60 Sample Output 100 56 48 65 70

0 Answers  


What is a symbolic constant?

1 Answers  


Do you have any idea about the use of "auto" keyword?

0 Answers  


enum DAY { sunday, monday, tuesday }; enum EDAYS { friday, saturday, sunday }; void main() { int i =0; if( i == sunday) { printf("%d",i); } } what would be the output?

4 Answers   TCS,


How to declare a variable?

0 Answers  


how do you programme Carrier Sense Multiple Access

0 Answers  


what is the value of 'i'? i=strlen("Blue")+strlen("People")/strlen("Red")-strlen("green")

7 Answers   Cadence, JNTU, Zen Technologies,


Categories