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
Differentiate between hashmap and treemap.
In what areas do data structures applied?
Which is better bubble sort or selection sort?
Define balancing condition for AVL Tree.
What is peek in stack?
What is sorting in math?
What is the structure of an array?
Which sorting is best for large data?
How do you do a selection sort?
Can we add heterogeneous elements into treemap?
Is bubble sort slow?
Write any two principles of gradation of structures.
Which is the parent class of deque
What are arrays give example?
What is a multidimensional array?