C++ Syntax Question:

Download Job Interview Questions and Answers PDF

How to access a variable of the structure?

Basic C++ Syntax Interview Question
Basic C++ Syntax Interview Question

Answer:

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

Download Basic C++ Syntax Interview Questions And Answers PDF

Previous QuestionNext Question
What is format for defining a structure?What is C strings syntax?