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 raid (redundant array of inexpensive disks)? Explain its level?
How do you do binary search?
what is the difference between singly and doubly linked lists?
What are the advantages of sorting and filtering data?
What is the difference between sorting and classifying?
How many null values are allowed in a set?
How do you sort an arraylist?
What are the complexity of binary search?
What is ds tree?
Why is hashmap not thread safe?
What is the best case complexity of quicksort?
Define a tree?
Is pointer a variable?
What is the difference between for and foreach loop?
Calculate the address of a random element present in a 2d array, given base address as ba.