| | |
Structures And Unions
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
-7
#2 Oct 6th, 2009
unions are used whenever the same data can be represented in two or more ways, or by two or more data types. Normally I think unions are place inside structures, something like a VARIANT structure. This structure has two members, an integer that tells which of the union members are used, and then the union of 20 or so data types.
>>.Also why are unions specifically used in mouse programming
AFAIK unions are not used for that purpose because the program needs to know both the x and y coordinates of the mouse. A union would not provide that information.
>>.Also why are unions specifically used in mouse programming
AFAIK unions are not used for that purpose because the program needs to know both the x and y coordinates of the mouse. A union would not provide that information.
Last edited by Ancient Dragon; Oct 6th, 2009 at 2:16 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
•
•
Join Date: Mar 2008
Posts: 1,482
Reputation:
Solved Threads: 123
2
#3 Oct 6th, 2009
•
•
•
•
Originally Posted by Ancient Dragon
Normally I think unions are place inside structures
I used it in the main scope as a structure inside of a union instead of the other way round. It helps when you want to assign values quickly. In fact, in the Pixel struct, i use a struct inside a union inside a struct
Last edited by William Hemsworth; Oct 6th, 2009 at 6:58 am.
I need pageviews! most fun profile ever :)
![]() |
Similar Threads
- A few questions about C++ (C++)
- Differences Between Java and C/C++ (C++)
- structures and unions in C++ (C++)
- A Few Questions On C (C)
- every thing is object? (C++)
Other Threads in the C Forum
- Previous Thread: Reverse Polish Notation
- Next Thread: How to make the output screen in C to stand for a long time.
| Thread Tools | Search this Thread |
Tag cloud for C
adobe ansi api array arrays asterisks bash binarysearch calculate centimeter char convert copyanyfile copyimagefile copypdffile cprogramme createcopyoffile csyntax directory dynamic fflush file fork frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators infiniteloop initialization interest km lazy linked linkedlist linux linuxsegmentationfault list locate logical_drives match matrix meter microsoft motherboard multi mysql number open opendocumentformat opensource owf pattern pdf performance pointer pointers posix power problem probleminc program programming pyramidusingturboccodes read recursion recv repetition scanf scheduling scripting segmentationfault send shape socketprograming spoonfeeding stack standard string strings structures suggestions systemcall test testautomation unix user variable voidmain() wab win32api windows.h






