C Programming - Pointers - Discussion
Discussion Forum : Pointers - General Questions (Q.No. 1)
1.
What is (void*)0?
Discussion:
124 comments Page 5 of 13.
Nirmal said:
1 decade ago
The 'void' its self a null pointer return type hence the answer is null.
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.
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.
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.
Sisira said:
1 decade ago
int *p=null;
int *p=;
null pointer or zero pointer.
int *p=88989;//error
int *p=;
null pointer or zero pointer.
int *p=88989;//error
Uttam said:
1 decade ago
Void pointer or generic pointer is a pointer that can be pointed to any datatype.
Hence while declaration it doesn't point to any datatype
it is called as Null pointer.
eg.
main()
{
int *p;
void *vp;
vp=p;
}
Hence while declaration it doesn't point to any datatype
it is called as Null pointer.
eg.
main()
{
int *p;
void *vp;
vp=p;
}
Isha said:
1 decade ago
Can anyone explain me clearly what is void and null pointer with examples?
Abhishek Srivastava said:
1 decade ago
Its quite an interesting question!!
VOID POINTER points no specific datatype.
NULL POINTER is a pointer of any data type with a NULL value to it, i.e it currently holds to no memory reference.
VOID POINTER points no specific datatype.
NULL POINTER is a pointer of any data type with a NULL value to it, i.e it currently holds to no memory reference.
Hitesh kumar said:
1 decade ago
(void*)0
like a null but not for all.
like a null but not for all.
Rani said:
1 decade ago
What is the purpose of giving void. What does it actuay mean by the warning given as "function should return value"while program is excecuted without void?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers