void is the type of function which doesn't need to return
then why is this program not working ?
#include <iostream>
using namespace std;
void addition(int a,int b);
{
int r;
r=a+b;
}
int main()
{
int z;
z=addition(5,4);
cout <<"the result is "<<z;
return 0;
}
Void doesn't return any value: here you are trying to store the returnvalue of the function into z, but the function doesn't have a returnvalue, and so it's not valid. addition() should be of type integer and return r.