Structs C++ - Reading Assignments

  1. Structs are ordered lists that are denoted by a single name and that contain in their entries the various variables (of various types) that characterize a given individual or entity. In other words, structs are used to efficiently denote and handle complex sets of data.
  2. The members in a struct are the list entries referred to above.
  3. The members are accessed using the syntax struct_name.member_name.
  4. A struct is said to be a ‘nested struct’ if some or all of its members are structs as well.
1 Like

Excellent answer sir! really well documented! keep it like that please! :muscle:

Carlos Z.

2 Likes
  1. We need to group variables that represent an object.
  2. These are variables or attributes into a struct.
  3. object.memberName
  4. When a struct has another struct like member.
1 Like
  1. Structs allow us to group variables with mixed data types together into one unit.
  2. Members are the variables that will contain the values.
  3. To access a member in a struct, you need to use the member selection operator. Example: name.age. Where age is the member.
  4. A nested struct is a struct within another struct.
1 Like
  1. Why do we need structs?
    Structs allow us to group variables of mixed data types together into a single unit
  2. What are members in a struct?
    variables that are part of the struct
  3. How do you access a member inside a struct?
    By using member selection operator - period “.”, for example " name.id "
  4. What is a nested struct?
    Struct containing other structs inside
1 Like
  1. We need structs to group variables of mixed data types together into a single unit.
  2. The variables that are inside of the struct.
  3. by using the member selection operator - “.”
  4. Struts that are inside of other struts.
1 Like

1. Why do we need structs?

The structs helping programmers with grouping multiple individual variables together into a single unit.

2. What are members in a struct?

Members in a struct are defined variables are part of a struct.

3. How do you access a member inside a struct?

We use the member selection operator ( period “.”) to access individual members.

4. What is a nested struct?

A nested struct is more structs which are contained in other where we just call structs operator from the previous one.

1 Like

1. Why do we need structs?
Structs (Short for Structure) are used to group variables of mixed data types together into a single unit. They are good for databases.

2. What are members in a struct?
The members are called variables.

3. How do you access a member inside a struct?
By using the member selection operator which is a period.
ex: struct.member

4. What is a nested struct?
This is when there are more than one struct in a member.

1 Like
  1. To be able to store multiple related data
  2. Variables declared within structs are called members.
  3. structName.memberName
  4. Struct containing other structs
1 Like
  1. A struct allows us to group variables of mixed data types together into a single unit. It’s useful when multiple values need to be linked with a certain identity.

  2. The variables.

  3. Using dots, after declaring a struct type to a variable. For instance: Variable.member = 3

  4. A struct containing other structs.

1 Like
  1. Because a struct allows us to group variables of mixed data types together into a single unit.
  2. They are variables contain in a struct.
  3. Using the member selection operator which is a period, for example joe.id, joe.age.
  4. They are structs which contain other structs.
1 Like
  1. Why do we need structs?
    They are essential to storing multiple types of data in an object.

  2. What are members in a struct?
    They are the variables that make up the struct.

  3. How do you access a member inside a struct?
    By the format: struct.member

  4. What is a nested struct?
    It’s a struct within a struct.

1 Like

Why do we need structs?

We need structs because sometimes we may need more than one variable to store information about an object and a struct allows us to group variables together as a single unit.

What are members in a struct?

The members in a struct are all the individual variables which make up the whole unit.

How do you access a member inside a struct?

To access a member inside a struct you would use dot notation to build a chain of references which lead to the member one is interested in such as identifier.member

What is a nested struct?

A nested struct is a struct with a reference to another struct which holds members which are related to the calling struct. an example would be identifier.struct1.struct2.member

1 Like

Excellent answer sir! really well documented! keep it like that please! :muscle:

Carlos Z.

  • Why do we need structs?
    A struct allows us to group variables of mixed data types together into a single unit.

  • What are members in a struct?
    Variables that are part of the struct

  • How do you access a member inside a struct?
    By using member selection operator

  • What is a nested struct?
    Structs that contains other structs

1 Like

3. How do you access a member inside a struct?

Indeed sir, but could you please describe a little bit about the operator?

If you have any more questions, please let us know so we can help you! :slight_smile:

Carlos Z.

To ground variables of different or of the same kind together.

variables.

by using the period operator.
Name of the struct.name of the member.

it is a struct in which one of more of its members is/are a struct.

1 Like
  1. Why do we need structs? - it allows one to group variables of mixed data types together into a single unit.

  2. What are members in a struct? - they are the variables that are defined inside of the struct. They are also called fields.

  3. How do you access a member inside a struct? - by using a period (called a member selection operator) to initialize each member variable…i.e struct.member

  4. What is a nested struct? - this is just a struct within a struct.

1 Like
  1. Why do we need structs?
    Essential is an object from javascript. Stores multiple variables.

  2. What are members in a struct?
    The variables that are apart of a struct.

  3. How do you access a member inside a struct?
    struct.member

  4. What is a nested struct?
    Another struct that is defined within a struct.

1 Like

Member selection operator ( . ) is preceded by an objects members or with a reference to an object to access the objects members.

1 Like