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:
- struct Person
- char name;
- int age;
- float salary;
Note: Remember to end the declaration with a semicolon (;)
FEATURES OF STRUCTURE OF PROGRAMMING
- Division of Complex problems into small procedures and functions.
- No presence of GOTO Statement
- The main statement includes – If-then-else, Call and Case statements.
- Large set of operators like arithmetic, relational, logical, bit manipulation, shift and part word operators.
- Inclusion of facilities for implementing entry points and external references in program.
Please follow and like us: