Wednesday

What is the difference between union and structure?


Q)What is the difference between union and structure?

Answer)

                       Structure                                                                                            
             1.We can access all the members of  structure at anytime 
                        Union  
             1.Only One member Can be accessed at anytime


                       Structure 
             2.Memory is allocated for all variables
                       Union                               
             2.Allocates memory for variable whichVariable
                 require more memory

                         Structure
            3.All members of Structur can be initialized
                         Union                          
            3.Only the first member of a union can be   
               initialized


                          Structure 
           4."Struct"   Keyword is Used to declare   structure
                         Union                             
           4."union" Keyword is used to declare union
           


                           Structure 
           5.All member has its own storage location
                           Union                         
           5.All members are stored in same location




Kindly Bookmark this Post using your favorite Bookmarking service:
Technorati Digg This Stumble Stumble Facebook Twitter
YOUR ADSENSE CODE GOES HERE

0 comments:

Post a Comment

Dont Forget for Commets

 

| C programing tutorials © 2009. All Rights Reserved | Template Style by My Blogger Tricks .com | Design by Brian Gardner | Back To Top |