+ 1
Hi guys I just start programming and I want to ask if one of you can explane me the function "void"
5 Answers
+ 2
It is a datatype,which does not written anything.Generally we pass void to main function i.e int main(void)
+ 1
It is a data type that does not return anything.
+ 1
thanks
+ 1
thanks
0
Hi
void is not any function.
It is not even considered as data type.
When you want your function to return nothing then use return type "void".
void sum(int a , int b)
{
int c = a + b;
}
the above function will calculate the sum but will not return anything since return type is mentioned as "void".
Similarly you can declare a function taking nothing as follows
void sum(void)
{
}