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

DNY said:   1 decade ago
Dear friend (void *) is very imp pointer that c allow us to keep any type data under it.

I simply mean that if we want store adds of int I=10;
Into any pointer we required int *.

But when we use void pointer mean it can hold adds of any type of variable.
Int I=10;
Void * vptr=&I;
Now ans of above question:

When we assign 0 value to any pointer simply it mean it pointing to 0000 location of memory.

It mean it is not pointing to any variable so it is NULL pointer.

Dhara said:   1 decade ago
What is difference between null pointer and generic pointer?

Sandeep rao said:   1 decade ago
It is pointer which return nothing or null. It is use in those function which simply print something.

Swetha said:   1 decade ago
If the zero is not indicate it returns null value only.

Kintali Prasanti said:   1 decade ago
Hi all,

As of I know this is the explanation.

Void pointer is a type of pointer which can store any type of value and null pointer is a pointer which does not point to anything. So here it is mentioned as "(void*)0" means we are declaring a void pointer holding 0 as its value which is an indirect representation of null pointer.

Thanks,

Dhiraj said:   1 decade ago
The void Type:

The void type specifies that no value is available. It is used in three kinds of situations:

S.N. Types and Description:

1. Function returns as void

There are various functions in C who do not return value or you can say they return void. A function with no return value has the return type as void. For example void exit (int status);

2. Function arguments as void

There are various functions in C who do not accept any parameter. A function with no parameter can accept as a void. For example int rand(void);

3. Pointers to void

A pointer of type void * represents the address of an object, but not its type. For example a memory allocation function void *malloc( size_t size ); returns a pointer to void which can be casted to any data type.

Vikram.s said:   1 decade ago
You can use the 0(zero) at the NULL, but in the program you may have the value 0(zero) which is required for the program, to differentiate that in <stdio.h> or <stddef.h> they have predefined this NULL as macro with,

#define NULL (void*)0.

Just to avoid the confusions of the value 0(zero), is value zero or NULL pointer.

Anitha said:   1 decade ago
void is a return type (void *) is represented by NULL pointer.

Rahul chaudhary said:   1 decade ago
int i=1,j;

j=sizeof(++i + j++);
printf("%d%d",i,j);

What will be the output of this program a getting confuse please explain it.

Rajput Naresh said:   1 decade ago
@Rahul.

Expression within sizeof() not solved.


Post your comments here:

Your comments will be displayed after verification.