I am self learning C++ and I found my self on the Pointers section of C++.
To my understanding the pointer allocates the value of a variable to a memory.
But I came across on this problem which the answer is 588.
And I cannot figure out how this number came up.
Can someone please explain me step by step how 588 came up ?
Thanks in advance.
#include <iostream>
int main() {
int *p, *q, *t;
// Allocate memory and initialize pointers and values
p = new int;
q = new int;
t = new int;
*p = 17;
*q = 7;
*t = 42;
p = t; // Make pointer p point to the same location as pointer t
t = q; // Make pointer t point to the same location as pointer q
*t = *p * *q;
*q = *q + *t;
std::cout << *t << std::endl;
return 0;
}