Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is sort order?

792


What does each entry in the link list called?

850


How null key is handled in hashmap?

846


What is the use of threaded binary tree?

938


What is the difference between one and two dimensional?

939


Two linked lists are given, find out the sum of them without altering the linked list?

914


What is circular linked list?

893


How to reference all the elements in a one-dimension array?

1227


Which sorting method is slowest?

907


What are the disadvantages of linear list?

862


What is a simple graph?

899


Define heap order property?

946


Write a program for Sorting an Array. Which sorting will you prefer?

917


What is difference between list and array list?

802


What is the difference between the hash table and hash map?

932