0

Does the pointer has the same functionality as the symbols in Ruby?

15th Jun 2016, 2:31 PM
Boris Atanasov
Boris Atanasov - avatar
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;
18th Jun 2016, 5:31 PM
destro
+ 1
and all that Is for saving a place of the disc right?
8th Feb 2017, 8:34 PM
Boris Atanasov
Boris Atanasov - avatar