What is the use of pointers ? Language c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the use of pointers ? Language c++

Pointers benefits

29th Jul 2019, 5:20 AM
The unknown 321
The unknown 321 - avatar
4 Answers
+ 2
To hold the address of variables/objects. This is mostly useful in C where function arguments are passed by value and you want to change a variable which may also be a data structure from within the function. In C++, arguments can also be passed by reference without the need for pointers in this case.
29th Jul 2019, 5:25 AM
Sonic
Sonic - avatar
0
What do you mean by changing a variable ? Does this mean that pointers are used to change variables in different ways
29th Jul 2019, 5:27 AM
The unknown 321
The unknown 321 - avatar
0
Martin Taylor please can you give a brief code example from this explination.
29th Jul 2019, 6:19 AM
The unknown 321
The unknown 321 - avatar
0
C++ ?
29th Jul 2019, 7:31 AM
The unknown 321
The unknown 321 - avatar