Pointers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Pointers

myFunc1(UnicodeString * p_ucs) { *p_ucs += "Its me here"; } myFunc2(Unicode &p_ucs) { p_ucs += "Im here again"; } int main() { UnicodeString ucs; ucs = "Hello world"; myFunc1(&ucs); myFunc2(ucs); } These 2 functions (myFunc1 & myFunc2) will "do the same thing" in a sense that the will actually go and alter (by concatenating) the value of p_ucs. My question is where would one use one over the other (* or &) ???? What exactly does each of these mean (* and &) ???

12th Apr 2017, 10:12 AM
Royal
Royal - avatar
1 Answer
+ 9
You can't do arithmetic on references and can't get their memory address. Also you can't reassign a value to a reference that's been assigned.
12th Apr 2017, 10:26 AM
Karl T.
Karl T. - avatar