Can you access allocated array elements with pointer.at(i) instead of pointer[i]? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can you access allocated array elements with pointer.at(i) instead of pointer[i]?

12th Apr 2020, 11:23 PM
ja008
ja008 - avatar
3 Answers
+ 7
It is a little unclear on what you are doing. It would be more clear if you were to provide an example. Specifically the initialization of the array, because you did not show if you are using a class array or primative array. like: std::vector<int*> number_vector; int* interger_ptr;
13th Apr 2020, 4:20 PM
Manual
Manual - avatar
+ 6
Did you try it?
13th Apr 2020, 1:14 AM
Manual
Manual - avatar
0
Manual Yes, but I'm getting the "attempt to use at with pointer type" error. So I'm wondering if it's not possible for some reason or there's another reason in my code why that doesn't work.
13th Apr 2020, 11:46 AM
ja008
ja008 - avatar