Answers

Question and Answer:

  Home  Basic C++ Syntax

⟩ How to access a variable of the structure?

To access a variable of the structure it goes:

name_of_single_structure.name_of_variable;

For example:

struct example {

int x;

};

struct example an_example; //Treating it like a normal variable type

an_example.x = 33; //How to access its members

 189 views

More Questions for you: