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.
Mamatha said:
1 decade ago
Void does not contain any return value.
Srividhya said:
1 decade ago
void does not return anything.
Nkv said:
1 decade ago
void does not have return type.
MOHD JAVED SAIFE said:
1 decade ago
Void is the type of data. That tells to the user that function does not return any value. And here in the program the void is used as a variable so C language does not allow in these kinds of declaration.
Yogeshwar Singh said:
1 decade ago
For Void there is no memory size defined for eg in 'int' data type the size is 2 byte, but for void it is not defined so we can not assign any value to void type.
Viniya philip said:
1 decade ago
Void is a return type of function not for variable.
Pallavi said:
1 decade ago
We can not define a variable with void type. Only we can define pointer of void type.
Sumathi said:
1 decade ago
What is the meaning of int main(). I can't understand the exact meaning. Please any one help me.
Ishwariya said:
1 decade ago
It is an error because void is not a data type.
Meghana said:
1 decade ago
Size of v is 0, since it is of type void which returns empty value.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers