C Programming - Pointers - Discussion
Discussion Forum : Pointers - General Questions (Q.No. 1)
1.
What is (void*)0?
Discussion:
124 comments Page 5 of 13.
Mayur 22kar said:
4 years ago
A void pointer is a pointer which nothing points anywhere In memory.
A null pointer means a pointer pointing to zero. In computer language, null value its just like initialize with zero.
A null pointer means a pointer pointing to zero. In computer language, null value its just like initialize with zero.
(11)
Kalpana said:
1 decade ago
Since void pointer can return any type of pointer, in this problem it returns an integer pointer. Since 0 is null value of integer, the pointer return will be a null pointer.....
Harshal Garg said:
9 years ago
In C, NULL is a macro.
It is defined as #define NULL 0.
So the above question can be seen as;
void *p;
p=(void *)0;
And the question is what is p?
The answer it is a null pointer
It is defined as #define NULL 0.
So the above question can be seen as;
void *p;
p=(void *)0;
And the question is what is p?
The answer it is a null pointer
MN SWARNA said:
1 decade ago
The 'void' keyword is represent no value but null pointer \0 or 0.
So () denotes the value * denotes address of memory location,
so (void*)0 is represent the NULL POINTER.
So () denotes the value * denotes address of memory location,
so (void*)0 is represent the NULL POINTER.
Hossam Ahmed ALi said:
2 years ago
I think the right answer is B) Void pointer.
The void pointer can point to any variable of any data type or point to NULL which means points to no location in the memory.
The void pointer can point to any variable of any data type or point to NULL which means points to no location in the memory.
(4)
Murali said:
1 decade ago
void pointer is a generic pointer. In the sense it doesn't fall under any standard types.
A generic pointer or void pointer at address 0 is nothing but a null pointer.
A generic pointer or void pointer at address 0 is nothing but a null pointer.
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.
Anurag said:
1 decade ago
#include<stdio.h>
main()
{
int num=258;
int *p=#
printf("%d %d \n",*((char*)p),*((char*)p+1));
}
Please give the answer with suitable reason?
main()
{
int num=258;
int *p=#
printf("%d %d \n",*((char*)p),*((char*)p+1));
}
Please give the answer with suitable reason?
Abhiram said:
1 year ago
It's a cast of 0 to (void *) '0' is a null value, so we got a NULL pointer.
void *ptr indicates void or generic pointer.
So (void *) is the address of pointer ptr.
void *ptr indicates void or generic pointer.
So (void *) is the address of pointer ptr.
(2)
Sachin said:
1 decade ago
I think answer should be B, as void * shows that it is pointer to a data type, means it is a pointer to void data type, it will store the address of any data type.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers