Is it possible to insert different type of elements in a stack? How?Yes, it is possible to insert different types of elements in a stack. Elements in a stack can be inserted using the “Push” operation. This operation writes an element on the stack and moving the pointer. Is it possible to insert different type of elements in a stack? How?Different elements can be inserted into a stack. This is possible by implementing union / structure data type. It is efficient to use union rather than structure, as only one item’s memory is used at a time.
|