+ 1
About pointers
Hello, could someone tell me when I will need the pointers? I understood very well, in assembler it was the only way to use the memory. But here in C ++ it seems that it is not really necessary since the variables, Arrays, etc works very well directly.
2 Antworten
+ 3
Pointers are necessary when you want to change the value of a variable from a different scope. For example when you want to pass a variable to a function and make the function change it's value, you need to pass the pointer to the variable.
Also, memory management is an important aspect in C++, and when you allocate a memory location or a block of memory locations, pointers to the location is returned, and then using the pointers we can assign values to those locations.
+ 1
Thank you both ! I had indeed realized later in the course, that it was the solution to modify the variables on the fly in the functions. & for address and * for value in the address.
In the end, it's still okay.