+ 1

Why we use pointer?

Why we use pointers? As we can do it normally using variables

12th Sep 2017, 4:04 PM
$h@dow
$h@dow - avatar
4 Antworten
+ 6
Pointer are the most strong and fast part of c/c++ to operate with variables, functions,methods and objects. On the other hand they are also the most dangerous part of the c/c++. Pointers are necessary for changing value of variables inside the function for example. It is also usable in c# but it is necesary to specify the part of code as unsave.
12th Sep 2017, 4:13 PM
Highman
Highman - avatar
+ 2
pointers are variable contains directly memory addresses (objects,methods,variables) it is very easy to overwrite it,forgot release allocated block of memory, to access beyond the limits (means out of allocated array).Simply sad,working directly with memory is dangerous all the time.To avoid these threads is good to use smart pointers (library for working with pointers by safer way).
12th Sep 2017, 9:23 PM
Highman
Highman - avatar
0
@high man how it can be dangerous
12th Sep 2017, 4:29 PM
$h@dow
$h@dow - avatar