what is struct used for in c++
C++ Programming/Structures - Structures. 1  A structure is a compound data type that contains different members of different types. The members are accessed by their names. 2  A struct is defined by... 3  The optional keywords public:, protected:, private: declare the protection status of the following members.