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 12 of 17.
Prasad said:
1 decade ago
Please tell me void is data type or keyword?
Lenin said:
1 decade ago
What advantage do we have declaring as a data type?
Firoz said:
1 decade ago
We must first convert it into desire data type before using it.
Vas krishna said:
1 decade ago
Because void is not a datatype. So syntaticaly its violates the declaration of a variable. So it raises compile time error.
Pavani said:
1 decade ago
We cannot declare a variable with void as data type.
DevendraSingh said:
1 decade ago
1. void is fundamental data type, which always return null(i.e void).
2. value can not be assigned to void because we cannot assign value to null, as it is already null, so it does not accept
void v = 0;
3. void is used to show return type of function only.
2. value can not be assigned to void because we cannot assign value to null, as it is already null, so it does not accept
void v = 0;
3. void is used to show return type of function only.
Rakesh kumar said:
1 decade ago
In c void means the variable we contains null value, which is not possible.
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'.
Mithilesh Upadhyay said:
1 decade ago
The void is primitive data type in C. The "void" can only used as return type for function definition. It cann't used for variable declaration.
Salunkhe amrut said:
1 decade ago
Void is return type we can declare pointer variable to void but not only variable.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers