If you mean you tried this:
Code:
#include <iostream>
using namespace std;
void changeArgument (int x)
{
x = x + 5;
}
int main()
{
changeArgument( 4 ); // pass int literal
return 0; // main() should return an int!
}
Then try again -- there is nothing wrong with that.
That would be an error, but not the error you refer to (you should post the code that actually produced that -- you have made a mistake or misinterpreted something).
The reason changeArgument() does not work with cout's << is because the return type is void. Try this:
Code:
#include <iostream>
using namespace std;
int changeArgument (int x)
{
x = x + 5;
return x;
}
int main()
{
cout << changeArgument( 4 );
return 0;
}
WRT post #3, you need to keep posting code to demonstrate what you are talking about, because you sound confused.
No, if the prototype for changeArgument() requires an int you must submit one. It doesn't matter whether it is used, how it is used, what other ints exist, etc.