Message from C, C++ talks

June 2019

— Or you tell her the flower pot number

— A pointer is not complex, in the end it's an integral value (a number) such as an integer.
Using pointers let's you access the same object in multiple places. E.g. you can access the local i in main although you are in a different function foo

void foo(int * pi) {
*pi = 7;

int main() {
int i = 3;
printf("%d", i);
printf("%d", i);

Message permanent page

— The flower pot number, in this case, is a pointer

— That's only the purpose of pointers


Imagine, every named object (a variable, such as int i) has a unique ID, it's address. A pointer stores this id. By using a pointer you can access the same object from basically everywhere.

— What did you expect?

— Foo(&I);

— Explain this

— That

— Pi is had a variable

— 7

— Would it be achievable with static too ?

— When you'd try to access i from main in foo()

— Also .. what's a practical use of triple pointers ? 🤔

— You mean int***?