What will be the output of the program and what is the reason for this output?
Write your answers in an ASCII-File
using namespace std;
int f(int i, int &r, int *p)
r = 2 * i;
i= *p + 10;
*p += 2;
cout << "i: " << i << endl;
int val= 12;
res = f(val, val, &val);
cout << "res: " << res << ", val: " << val << endl;
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.
There would be no output because it would not compile because 'res' has not been declared.
considering int res instead of res, the ouput will be 34.
thanks a lot buffbill n saurabh...