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 10 of 17.
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:
10 years 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:
7 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:
7 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.
Shalini k said:
1 decade ago
void doesn't return anything so instead of void if int is declared we get the result as 0.
Deboshree said:
1 decade ago
A variable cannot be of void type only a function or a pointer can be declared as void.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers