C Programming - Declarations and Initializations - Discussion
Discussion Forum : Declarations and Initializations - Point Out Errors (Q.No. 2)
2.
Point out the error in the following program.
#include<stdio.h>
int main()
{
void v = 0;
printf("%d", v);
return 0;
}
Discussion:
168 comments Page 12 of 17.
Gowri said:
1 decade ago
void is a return type specifier. Its does not expect a value. So v=0; is a error.
Manish said:
1 decade ago
Void means empty so nothing should get returned, that it must not have any value.
Ambi said:
2 decades ago
You can never create a void variable. Only Creation of void pointer is possible.
Divya said:
1 decade ago
Void returns only zero.
We cannot use it like data type only use return type.
We cannot use it like data type only use return type.
Karthick,sairaj said:
1 decade ago
We can't use void for variable declarations. Since void returns NULL values.
Rakesh kumar said:
1 decade ago
In c void means the variable we contains null value, which is not possible.
Vikas said:
2 decades ago
We can't create a void variable but we can create a void pointer variable.
Bhagyesh said:
1 decade ago
Void is not using for declaration of variable in c and in oop's language.
Prathik said:
2 decades ago
Void can be used as int, char so what is the error in the above program.
Ashitosh m n said:
1 decade ago
We not declare or initialize a variable using void.
It is not possible.
It is not possible.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers