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
Write a code for dynamic allocation of array.
Is it necessary to sort a file before searching a particular item ?
Describe the height term in a tree.
How to use appendNode() in linkedlist()?
Which is faster hashmap or hashtable?
How is a queue works?
How efficient is bubble sort?
Why is null not allowed in concurrenthashmap?
What is immutablelist?
What is bubble sort used for?
For the following COBOL code, draw the Binary tree? 01 STUDENT_REC. 02 NAME. 03 FIRST_NAME PIC X(10). 03 LAST_NAME PIC X(10). 02 YEAR_OF_STUDY. 03 FIRST_SEM PIC XX. 03 SECOND_SEM PIC XX.
What is the difference between array list and vector list?
Why is an array homogeneous?
What is a treemap used for?
Is copyonwritearraylist thread safe?