C Programming - Pointers - Discussion
Discussion Forum : Pointers - General Questions (Q.No. 1)
1.
What is (void*)0?
Discussion:
124 comments Page 9 of 13.
Preet said:
1 decade ago
The 'void pointer' is pointer that contain address but the datatype of the value stored at that address is not known.
It can be cast to any data type while Null pointer is a pointer that always refers to the 0th location of memory. This location is always reserved for Null and any other value can't be stored in that location.
That's why (void*)0 is NULL pointer.
It can be cast to any data type while Null pointer is a pointer that always refers to the 0th location of memory. This location is always reserved for Null and any other value can't be stored in that location.
That's why (void*)0 is NULL pointer.
Prema said:
1 decade ago
I thick (void*) type casting, if we specify (void) 0 it is void pointer, now we specify (void*) 0 so it is null pointer.
Yogen raja said:
1 decade ago
The void pointer is pointer in which we can store the address of any type of variable i.e malloc() always returns void pointer because that function never knows that to which type we are allocating memory dynamically.
Nirmal said:
1 decade ago
The 'void' its self a null pointer return type hence the answer is null.
Pruthvi said:
1 decade ago
Can any one explain me what is the use of void/null pointer then??
Amol said:
1 decade ago
(void *) is nothing but generic pointer. We can convert it into any other type of pointer Eg. int pointer, float pointer, by type casting it ie we can convert void pointer into int as int(void *). This generic pointer point to memory location.
Kishor said:
1 decade ago
Ii is void pointer if the declaration is void *
But in the e.g. it is given (void *)0 Hence it is null pointer.
But in the e.g. it is given (void *)0 Hence it is null pointer.
Partha said:
1 decade ago
Void pointer is a pointer that can point to any type of data. Null pointer is a pointer that shows that the pointer doesnt point to any valid data.
According to me this is both a void and a null pointer.
According to me this is both a void and a null pointer.
Yeswanth said:
1 decade ago
The keyword - void - itself represents that it is null and * indicates pointer so simply it indicates null pointer.
And void* represents that a pointer having no values.
For eg. in sets void={} -it represents null set na. Like that...
And void* represents that a pointer having no values.
For eg. in sets void={} -it represents null set na. Like that...
Sandeep said:
1 decade ago
:ITS IS A ERROR BECAUSE * DOES NOT COMES BEFORE VOID
VOID DOES NOT RETURS ANY VALUE
VOID DOES NOT RETURS ANY VALUE
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers