| Share this post! | Vote this! |
|
What is a Union?
If we are having the less memory to use in our program, for example 64K, we can use a single memory location for more than one variable this is called union.You can use the unios in the followig locations.
- You can share a single memory location for a variable myVar1 and use the same location for myVar2 of different data type when myVar1 is not required any more.
- You can use it if you want to user, for example, a long variable as two short type variables.
- When you dont know what type of data is to be passed to a function, and you pass union which contains all the possible data types. more...




0 comments:
Post a Comment