Spread the love
  • Initializing structure
    • structure_name variable_name = {value1,value2,…,valueN};
  • Initializing nested structure
    • structure_name variable_name = { {value1, value2},{value3,value4}};
  • A structure can be nested up to any depth in theory.
  • Structure can hold data and functions (In c they can only hold data)
  • An enum declaration defines the set of all names that will be permissible values of the type. These permissible values are called enumberators.
    • e.g. enum days{Mon,Tue,…,Sun};
    • days d1,d2;
    • In c we have to use enum keyword while creating variable of enum type. e.g. enum days d1,d2;
  • Enumerations are treated as Integer types internally. The value of first name is 0. We can change it :
    • e.g. enum suit{clubs=1,diamonds};   Now clubs will have value 1 and subsequent value have 2,3 and so on.
  • Enums are not recognised by c++ I/O statements
    • e.g. suit s = clubs;
    • cout << s;
    • above example will output 1 and not clubs.