0
What is the difference between int and void functions?
How do I know when to use int and void main?
3 Answers
+ 9
void means not return any values
int means return integer values
+ 5
int x(n){
return n;
}
//I call it in code below:
int main(){
int j = x(1);
return 0;
}
//j = 1 same as returning value
+ 4
for example:
------------------------------------------------------------------
void a(){
cout<<"a";
}
------------------------------------------------------------------
if I call this (in main method) it's only display "a" does not return any values.