Why should we use struct for stack?

Hello,

Why should we use struct for stack? Can we use another type to create a struct? for example: create stuct with class!

The class keys struct and class are indistinguishable in C++, except that the default access mode and default inheritance mode are public if class declaration uses the struct class-key and private if the class declaration uses the class class-key. Both class and struct can be used in a class definition.
https://en.cppreference.com/w/cpp/language/classes
c++ has multiple built in stacks. you would only make another for learning reasons, and can use whatever suits you for that.
Topic archived. No new replies allowed.