Jun 26, 2013 at 7:07am UTC
What will be the output of the program and what is the reason for this output?
Write your answers in an ASCII-File
#include <iostream>
using namespace std;
int f(int i, int &r, int *p)
{
r = 2 * i;
i= *p + 10;
*p += 2;
cout << "i: " << i << endl;
return r;
}
int main()
{
int val= 12;
res = f(val, val, &val);
cout << "res: " << res << ", val: " << val << endl;
return 0;
}
Jun 26, 2013 at 7:14am UTC
No one here is going to do your h/w for you. Get a compiler and run it yourself. If you have any problems write them. Also, try to learn to use code tags.
Jun 27, 2013 at 4:41am UTC
There would be no output because it would not compile because 'res' has not been declared.
Jun 27, 2013 at 6:48am UTC
considering int res instead of res, the ouput will be 34.
Jun 27, 2013 at 6:57am UTC
thanks a lot buffbill n saurabh...