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;
}
Error: Declaration syntax error 'v' (or) Size of v is unknown or zero.
Program terminates abnormally.
No error.
None of these.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
165 comments Page 14 of 17.

Bharath said:   8 years ago
Void itself is a null value. You cannot declare a null value.

Nithin said:   1 decade ago
void is a return type and variable should not declare to it.

Karthi said:   1 decade ago
Void is a return type. It cannot be assigned for variables.

Devanshmody said:   1 decade ago
Data type should be of int or one can use typedef function.

R.Harish said:   1 decade ago
void is not an data type.

void does not return any value.

Ankit said:   1 decade ago
In simple terms void can not be assigned any value .....

Pavani said:   1 decade ago
We cannot declare a variable with void as data type.

Keya said:   1 decade ago
Void is prototype so we can not initialize variable.

Shruthi hebbal said:   1 decade ago
I think there is no datatype as void in c language.

Lenin said:   1 decade ago
What advantage do we have declaring as a data type?


Post your comments here:

Your comments will be displayed after verification.