C Programming - Pointers - Discussion
Discussion Forum : Pointers - General Questions (Q.No. 1)
1.
What is (void*)0?
Discussion:
124 comments Page 5 of 13.
Gowthami said:
1 decade ago
Void data type does not have values.
Rajput Naresh said:
1 decade ago
@Rahul.
Expression within sizeof() not solved.
Expression within sizeof() not solved.
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.
j=sizeof(++i + j++);
printf("%d%d",i,j);
What will be the output of this program a getting confuse please explain it.
Anitha said:
1 decade ago
void is a return type (void *) is represented by NULL pointer.
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.
#define NULL (void*)0.
Just to avoid the confusions of the value 0(zero), is value zero or NULL pointer.
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.
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.
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,
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,
Swetha said:
1 decade ago
If the zero is not indicate it returns null value only.
Sandeep rao said:
1 decade ago
It is pointer which return nothing or null. It is use in those function which simply print something.
Dhara said:
1 decade ago
What is difference between null pointer and generic pointer?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers