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 13 of 17.
Shivkumar Hegonde said:
7 years ago
Void is not a valid data type to store the data. It should be void *.
(1)
Rahini said:
1 decade ago
Variable is not assigned in void, only pointer variable is declared.
Meghana said:
1 decade ago
Size of v is 0, since it is of type void which returns empty value.
Dharanesh said:
1 decade ago
As we know void is keyword not a datatype. It does return nothing.
Firoz said:
1 decade ago
We must first convert it into desire data type before using it.
Dipak said:
5 years ago
Void is keyword in c so that we can't use it for variable name.
(2)
BaBa said:
1 decade ago
Only function and pointer can be declare as void not variable.
Hardik said:
1 decade ago
Can not declare like this void is keyword it's not a datatype.
Mass said:
1 decade ago
In printf statement we should have ambesend symbol as &v.
Hemant said:
1 decade ago
We cannot declare void variable.
Can only make void pointer.
Can only make void pointer.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers