We see lots of void in C. Lets clear why we all use this.
int myFunc(void){
}
it means it will return int type value but will not take any parameters..it is also good to define in function prototype
int myFunc(){
}
it means it will return int type value but will take parameters that is defined:
void myFunc(){
}
it means it will return nothing and if we use return here it will show error as void can’t return a value
void myFunc()
{
return 0; //it will show error
}
or
void myFunc()
{
return; //it will show error
}
but we can return from a condition here is one example:
void myFunc(int n)
{
if(n==0)
return; //it will return 1 as true to make truth to any condition
}
but if we use return value with int return type it will return 1 as true returning.
example could be written as:
int myFunc(){
return; //will return 1 as true that it is returning as we didn't returned any specific value
}
Source: Took some help:
http://stackoverflow.com/questions/1043034/what-does-void-mean-in-c-c-and-c
http://stackoverflow.com/questions/416345/is-fvoid-deprecated-in-modern-c-and-c