Question:
Make function which will sum two integer variables (a,b) and then return result in variable rez , using pointer. Also, in the same function, return sum a+b+10 in another variable rez_a using pointer.
Well, here is the code. It returns only the first value (*p1):
#include <iostream>
using namespace std;
int vrati(int a, int b) {
int rez = a + b;
int rez_a = a + b + 10;
int* p1 = &rez;
int* p2 = &rez_a;
return *p1,*p2;
}
int main() {
int a = 4;
int b = 6;
cout << vrati(a, b);
return 0;
}