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:
165 comments Page 11 of 17.
Sayali said:
8 years ago
void is a return type, not a data type. Hence we can not use it to declare a variable.
Pallavi said:
1 decade ago
We can not define a variable with void type. Only we can define pointer of void type.
Manish NIITian said:
1 decade ago
Void is return type keyword, so it can't be used as like datatype in c, C++ and C #.
Vijay kumar said:
1 decade ago
Void mean empty or NULL value. So void keyword cannot use variable declaration in C.
Rohan said:
1 decade ago
We can't use void to declare the variables in c because void is a derived data type.
K SURESHBABU said:
1 decade ago
void means that it does not return nothing.Here void declare to the V is not taken.
Vinay Singh & Pannelal Goswami said:
1 decade ago
"Void" is no return type keyword for function use, not use in variable declaration.
Salunkhe amrut said:
1 decade ago
Void is return type we can declare pointer variable to void but not only variable.
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:
9 years ago
Void means empty so nothing should get returned, that it must not have any value.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers