How is it possible to insert different type of elements in
stack?
Answer Posted / krishan
We can use a struct containing "void * " in it and an
unsigned int to store the datatype which "void *" will store
(can be set at time of storing the value). To store a value
of any type we can dynamically allocate the space and set
the unsigned int to some pre-determined constants. Like
1 for int type.
2 for char.
3 for char string.
4 for any other type. say some user datatype.
| Is This Answer Correct ? | 21 Yes | 12 No |
Post New Answer View All Answers
What is sort order?
What does each entry in the link list called?
How null key is handled in hashmap?
What is the use of threaded binary tree?
What is the difference between one and two dimensional?
Two linked lists are given, find out the sum of them without altering the linked list?
What is circular linked list?
How to reference all the elements in a one-dimension array?
Which sorting method is slowest?
What are the disadvantages of linear list?
What is a simple graph?
Define heap order property?
Write a program for Sorting an Array. Which sorting will you prefer?
What is difference between list and array list?
What is the difference between the hash table and hash map?