Computer Science, asked by firoz94, 1 year ago

int f(int* a, int b) {
b = b - 1:
if (b == 0) return 1;
*a = *a + 1; // **a' accesses the value pointed to by pointer 'a'
return f(a, b) *(*a);
int main({
int a = 3;
int b = 3;
return f(&a, b);​

Answers

Answered by rimi9616
2

Answer:

int a = 32, *ptr = &a;

char ch = 'A', &cho = ch;

cho += a;

*ptr += ch;

cout << a << ", " << ch << endl;

return 0;

}

Options:

a. 32, A

b. 32, a

c. 129, a

d. 129, A

Answer: c. 129, a

Explanation: The “ptr” variable is a pointer which holds the address of variable “a”. And “*ptr” returns the value of “a” variable. “cho” is a reference variable to “ch”. So any change made to “cho” will be reflected to “ch”. As such, when “cho” is increased by 32, it adds to the ASCII value of “A”(which is 65), and this results to 97 which is the ASCII value of “a”(from the alphabet). So this “a” gets stored in “ch”. As for when “*ptr” is incremented by “ch”, it gives value 97+32=129

Similar questions