double integer variable in another function
suppose i define r=2 in a function g().how do i display twice the value of r in my main()?
You use r in the return value of g:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
#include <iostream>
int g()
{
int r=2;
return 2*r;
}
int
main()
{
std::cout << g() << '\n';
}
|
Topic archived. No new replies allowed.