C++ access class struct memebr using an array pointer

Tags: c++ pointers
By : Flow
Source: Stackoverflow.com
Question!

Sorry if the title doesn't make sense. I don't know how to word it as I'm fairly new to C++. Basically I have this:

sf::VertexArray *vArray;

If I want to access the position inside, I would have to do this:

(*vArray)[0].position = ...;

Is there a way to use the arrow notation instead? Why can't I do this: vArray[0]->position = ...;?

Any help would be appreciated!

EDIT: sf::VertexArray is part of the SFML library: https://github.com/SFML/SFML/blob/master/src/SFML/Graphics/VertexArray.cpp

By : Flow


Answers

If your original line

(*vArray)[0].position = ...;

properly illustrates the semantics of your data structure, then the -

By : AnT


This video can help you solving your question :)
By: admin