What is structure in C++ programming

What is structure in C++ programming ?

Structure is a collection of variables of different data types under a single name. It is similar to a class in that, both holds a collection of data of different data types.

How to declare a structure in C++ programming?

The struct keyword defines a structure type followed by an identifier (name of the structure).

Then inside the curly braces, you can declare one or more members (declare variables inside curly braces) of that structure. For example:

  1. struct Person
  2. {
  3.     char name[50];
  4.     int age;
  5.     float salary;
  6. };

Note: Remember to end the declaration with a semicolon (;)

 

FEATURES OF STRUCTURE OF PROGRAMMING

  1. Division of Complex problems into small procedures and functions.
  2. No presence of GOTO Statement
  3. The main statement includes – If-then-else, Call and Case statements.
  4. Large set of operators like arithmetic, relational, logical, bit manipulation, shift and part word operators.
  5. Inclusion of facilities for implementing entry points and external references in program.

 

Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *