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 7 of 17.
Lenin said:
1 decade ago
What advantage do we have declaring as a data type?
Prasad said:
1 decade ago
Please tell me void is data type or keyword?
Sunil Kumar(S.K) said:
1 decade ago
Only pointer can be void not a variable.
Arpita Baheti said:
1 decade ago
For declaration of any variable required datatype variable
That is
Ex int v=0;
void is a return type not a datatype,
Therefore in this program, void v=0;.
Generates an error.
That is
Ex int v=0;
void is a return type not a datatype,
Therefore in this program, void v=0;.
Generates an error.
Divya said:
1 decade ago
Void returns only zero.
We cannot use it like data type only use return type.
We cannot use it like data type only use return type.
Panchanan said:
1 decade ago
Void is an generic pointer which contain any type of data. But it's size is unknown value. Before assign the void pointer value you must type converted into the required one.
void v;
int b;
b=(int)v;
void v;
int b;
b=(int)v;
Devanshmody said:
1 decade ago
Data type should be of int or one can use typedef function.
Devi said:
1 decade ago
Void is a data type and we can use it at any time.
BaBa said:
1 decade ago
Only function and pointer can be declare as void not variable.
HEMALATHA said:
1 decade ago
What is the format specifier for 'void'?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers