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 10 of 17.
Mukesh Rai said:
1 decade ago
The "void" is used as a data type but we can not use it for variable declaration in 'C'.
Shantanu said:
1 decade ago
While initializing the variable requires a valid data type. void is return type not a data 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.
Keyur vyas said:
1 decade ago
It's not possible,
Because of we never declare or initialize this kind of variable using void.
Because of we never declare or initialize this kind of variable using void.
Arti said:
1 decade ago
'void' is a keyword and a keyword can't be initialized, if we try to do so it will show error.
Hari krishna said:
8 years ago
Here, the void is in pointer when we use void, convert (typecasting) into a desired data type.
Srinivas said:
1 decade ago
void is an predefined data type, void means nothing.
So we can't define variables for void.
So we can't define variables for void.
Silpa said:
8 years ago
Hi friends, in my view, the void is a primary data type and it (void) means no return value.
Yusuf MJ said:
1 decade ago
No data type is there to 'v' here.
Void is not a data type to be assigned to any variable.
Void is not a data type to be assigned to any variable.
Mohini said:
1 decade ago
Void is a primitive data type but it declaration of variable using void is wrong!thats it.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers