As i m using int or void to create a function, and in both the cases if i m calling the function … i m getting the same result , can you explain whats the difference between the two?
Void and int to create functions
@thakur0_0 hey,void and int both are return type of function ,suppose you want to return an integer from function than you use int return type and to get that return value from function take int and get value by calling function whereas void function return nothing so you can call directly by calling function name with parameter:
eg
void fun()
{
}
main()
{
//just call simply
fun();
}
int fun()
{
return 1;
}
main()
{
//take int a and get return value of function
int a=fun();
cout<<a;//1
}
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.