C Programming - Pointers - Discussion
Discussion Forum : Pointers - General Questions (Q.No. 1)
1.
What is (void*)0?
Discussion:
124 comments Page 6 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.
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?
Vinod said:
1 decade ago
The syntax of NULL pointer is:
datatype *ptrname = NULL;
or
datatype *ptrname=(datatype*)0;
So, here the question is what is " (void*)0 "..?
by the above syntax we can say that (void*)0 is represents null pointer..
datatype *ptrname = NULL;
or
datatype *ptrname=(datatype*)0;
So, here the question is what is " (void*)0 "..?
by the above syntax we can say that (void*)0 is represents null pointer..
Dilip Sharma said:
1 decade ago
(void*)0 means pointer to void i.e memory location are pointed and 0 denote that our pointer point to memory location which is 0 hence it will show Null pointer.
Makhan said:
1 decade ago
What is (void*)0?
what answer of that generated question?
what answer of that generated question?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers