0
Does the pointer has the same functionality as the symbols in Ruby?
2 Réponses
+ 1
no, in Ruby it's used to split arrays if memory serves correctly. in c++ the pointer, *, is used to point to a certain values memory address. consider the following :
int a = 5;
int *ptr = &a;
here we have created an integer a and let's say it exists in memory location 100. we also created an integer pointer (not an integer but a pointer that can access integer variables), and let's say our pointer exists in memory location 500. when we say *ptr = &a what were saying is "I want my pointer ptr to get the memory address (& symbol) of a, and set that to be it's value." so now if we print the value of ptr to the screen we'll get this:
cout >> "ptr = " >>ptr >>endl;
OUTPUT: ptr = 100;
+ 1
and all that Is for saving a place of the disc right?