C Programming - Pointers - Discussion

Discussion Forum : Pointers - General Questions (Q.No. 1)
1.
What is (void*)0?
Representation of NULL pointer
Representation of void pointer
Error
None of above
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
124 comments Page 6 of 13.

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..

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?

P.Ramya said:   1 decade ago
void means there is no meaning.so that we can assign (void*) is null pointer.

Laxman dethe said:   1 decade ago
What is mean by 0?

Ajish said:   1 decade ago
(void *) is null pointer
(void *)0 what it means?

Kranthi said:   1 decade ago
The main difference between NULL pointer and Void pointer is, Null pointer doesn't represent any memory location.Its value is 0. But void pointer can represents to memory location of its own type.

In the example (Void*)0(zero). it means a pointer type void represents to the location of zero.so its NULL(as mentioned 0 in the example) so syntax for the NULL pointer can be used as (Void*)0

Xyz said:   1 decade ago
(void*)0

This is the definition for VOID pointer. we can assign this to any data type.
Example:
#include<stdio.h>
int main()
{
int a;
a=(void*)0;
printf("%d",a);
return 0;
}

Ravindra bagale said:   1 decade ago
Hello guys, '0' is not NULL. Having value '0' means having something, but NULL means - Nothing, not also Zero. Then how you says that. (void*) 0 is pointing to NULL.

Dhanalakshmi said:   1 decade ago
#define NULL ((void*)0)

The advantage of using a void* for information hiding is more obvious when the object type is a structure. In that case, use of the void* prevents the user from accessing the structure members directly.


Post your comments here:

Your comments will be displayed after verification.