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 11 of 13.

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.

Anubhuti said:   1 decade ago
It is a null pointer.

If you try this float *a = (void*)0;

printf("%u \n", a);

You will see value of a;

Brajesh said:   1 decade ago
void* p is a generic pointer to convert any types of data like-int, float, char to use of type casting. Important think is that all types of pointer can be null.

But here is (void*)0: It means void pointer to hold the address of any location but hold null value.

MANISH said:   10 years ago
#include<stdio.h>
void print(int*,int*,int*,int*,int*);
int main()
{
int arr[]={97,98,99,100,101,102,103,104};
int *ptr=arr+1;

print(++ptr,ptr--,ptr,ptr++,++ptr);
return 0;
}
void print(int *a,int *b,int *c,int *d,int *e)
{
printf("%d %d %d %d %d",*a,*b,*c,*d,*e);
}


Please help my in understanding the output of the above. Each step with clear description.

Yogesh said:   10 years ago
Initially *ptr pointing to arr [1]. So that reason above answer is correct as per my knowledge.

Ganesh said:   10 years ago
Void is generic Pointer used for holding address of any data type.

Lakhan said:   9 years ago
Void pointer is pointer which has no specific data type so when we not mention any data type for this pointer. So it return us global value i.e. null.

Ajith kumar said:   9 years ago
What is meant by pointer?

Dushyant said:   9 years ago
Void is no return type. If I write (void*) something then print the void value=null.

Veena kumari said:   9 years ago
'Null Pointer' means which reference nothing (means it doesn't point any address) and void pointer mean we can store any type of value's address (like address of the variable int, char, float, etc.).


Post your comments here:

Your comments will be displayed after verification.