| 1. |
Explain the process of the creation of a structure in C++ with an example. |
|
Answer» struct <structure-tag> { <data_type> <member variable 1>}list of members <data_type> <member variable 2>} list of members <data_type> <member variable 3> } <structure-variable-name 1>,<structure-variable-name 2>; is the reserved or keyword used in structure definition. : Is the name given by the programmer and used to identify the structure in future re-definitions. They are used to declare structure variables. <data-type>: Any valid data type in ‘C’ < member variable 1…4>: are names of the variables. <structure-variable-name 1...2>: It is used to access the members of the structure Example: struct student { int regno; char name[20]; char class[5]; char combination[4]; float fees; }st,st2,st3; |
|