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 3 of 17.
Vikas said:
1 decade ago
We can't create a void variable but we can create a void pointer variable.
Surbhi said:
1 decade ago
Can we create void data types in c?
Shruthi hebbal said:
1 decade ago
I think there is no datatype as void in c language.
HARIKRISHNAN.P said:
1 decade ago
void is a primitive data type in C.
void, in C has no size. Thus, if you were to declare a variable of type "void", the compiler would not know how much memory to allocate for it.
void, in C has no size. Thus, if you were to declare a variable of type "void", the compiler would not know how much memory to allocate for it.
Najamunnisa begum said:
1 decade ago
When we declare the variable memory will not be allocated but when we initialize we need memory to store that variable value.
Since, void is not a data type it results in error.
Since, void is not a data type it results in error.
Manish NIITian said:
1 decade ago
Void is return type keyword, so it can't be used as like datatype in c, C++ and C #.
Ankit said:
1 decade ago
In simple terms void can not be assigned any value .....
Rohit singh said:
1 decade ago
Void doesnt contain any type of value.
Pallavee said:
1 decade ago
1) void is a special kind of data type. It can be used only with functions ie as a return value for a function.
2) void is a keyword in C.
2) void is a keyword in C.
Sonia said:
1 decade ago
We can't create a void datatype variable, we can only create a void type pointer so that it can be assign to any other typr of pointer.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers