Why do we use pointers in c++??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Why do we use pointers in c++???

17th Jul 2016, 4:01 AM
Suryansh
Suryansh - avatar
2 Answers
+ 2
consider the variable as a person and his address as a pointer . Now would it be easier to or faster to find a person in this world by his/her name OR if you had his/her residence address pointers basically make your execution faster (as per my understanding) Also you can permanently alter the value of the variable . pls do correct me if you think i m wrong
27th Jul 2016, 2:28 AM
RAJIV SHAH
RAJIV SHAH - avatar
+ 1
there are several reasons first is to have dynamic memory allocation of variables so that we use memory that is required only second is to access strings third it makes all the array operation more easier we can make several function. using one code in ptrs
17th Jul 2016, 6:34 AM
manish rawat
manish rawat - avatar