C Programming - Pointers - Discussion
Discussion Forum : Pointers - General Questions (Q.No. 1)
1.
What is (void*)0?
Discussion:
124 comments Page 7 of 13.
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?
(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
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;
}
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.
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.
Sumit jaiswal said:
1 decade ago
Void pointer does point any data type but null pointer does not point anywhere.
AmolRaje Lendave said:
1 decade ago
Void pointer is a pointer which is used to point any type of variable..
0 is used to indicate that this pointer does't have any address means it is NULL. Thats why first option is correct.
0 is used to indicate that this pointer does't have any address means it is NULL. Thats why first option is correct.
Gowda said:
1 decade ago
( void * ) is a void pointer..means its a pointer with no specific type...Integer zero 0 has various description depending upon the context in which it is used.
Each pointer has its own NULL values.In fact NULL is #defined in stddef.h to zero value.So NULL pointer basically means pointer containing zero or referencing no where...
for example
int main()
{
int *p=NULL;
if(p==0)
printf("hello");
return 0;
}
prints hello
and we have '\0' null char which is basically a value with all bits set zero...These null pointer and null char are for the purpose programmer convinience
Each pointer has its own NULL values.In fact NULL is #defined in stddef.h to zero value.So NULL pointer basically means pointer containing zero or referencing no where...
for example
int main()
{
int *p=NULL;
if(p==0)
printf("hello");
return 0;
}
prints hello
and we have '\0' null char which is basically a value with all bits set zero...These null pointer and null char are for the purpose programmer convinience
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers