IndiaBIX.com
Arithmetic Aptitude Data Interpretation
Logical Reasoning Verbal Reasoning Non Verbal Reasoning
General Knowledge
Sudoku Number puzzles Missing letters puzzles Logical puzzles Playing cards puzzles Clock puzzles
C Programming C# Programming Java Programming
Networking Database Questions Computer Science Basic Electronics Digital Electronics Electronic Devices Circuit Simulation Electrical Enigneering Engineering Mechanics Technical Drawing
Placement Papers Group Disucssion HR Interview Technical Interview Body Language
Aptitude Test Verbal Ability Test Verbal Reasoning Test Logical Reasoning Test C Programming Test Java Programming Test Data Interpretation Test General Knowledge Test
Data Structures Operating Systems Networking DATABASE Database Basics SQL Server Basics SQL Server Advanced SQL Server 2008 JAVA Core Java Java Basics Advanced Java UNIX Unix File Management Unix Memory Management Unix Process Managemnt C Interview Questions The C Language Basics .NET Interview Questions .NET Framework ADO.NET ASP.NET Software Testing

C Programming - Structures, Unions, Enums - Discussion

@ : Home > C Programming > Structures, Unions, Enums > General Questions - Discussion

2. 

What is the similarity between a structure, union and enumeration?

[A]. All of them let you define new values
[B]. All of them let you define new data types
[C]. All of them let you define new pointers
[D]. All of them let you define new structures

Answer: Option B

Explanation:

No answer description available for this question.


Runa said: (Tue, Jul 27, 2010 11:37:45 AM)    
 
Structures unions and enumeration is used to create a new datatyppe that holds all kinds of datatype that is it includesn a datatype that can hold int, float, char, array inside a user ndefined datatype.

Pradeep Bhupathi said: (Wed, Aug 25, 2010 02:42:30 PM)    
 
Array, pointer, structure, union, enum - These all are user defind data types in c language.

Lokeswari said: (Sun, Dec 5, 2010 12:13:57 PM)    
 
What is pointer?

Yamuna said: (Thu, Dec 9, 2010 08:11:33 AM)    
 
Since Structure,Union,Enum are all User defined data types so user can use new values...thus logic is simple.. :-)

Varun said: (Fri, Jan 7, 2011 02:06:36 PM)    
 
But what is the difference?

Lipsa said: (Tue, Feb 1, 2011 10:05:01 AM)    
 
I agree with the runa and the main difference is the structure allocate different memory location with the data types but union allocate one large memory location for their members.

Surya said: (Thu, Mar 10, 2011 12:58:25 AM)    
 
These are used to create a new data type that holds all data types.

Nagarjun said: (Thu, Mar 10, 2011 05:22:36 AM)    
 
S.I agree vtt the Lips .but Enumrated gives the different states of a variable
example;
Enum person
{
male,fmale;
}
where the person having 2 states male r female;

Devi said: (Fri, Mar 11, 2011 03:35:16 AM)    
 
Thanks for your explanation.

Ashish Moreshwar said: (Tue, Apr 12, 2011 01:12:05 AM)    
 
Question is the similarity between a structure, union and enumeration. I think These all are the user defined data type. That holds various types of other data types.

Sivaramakrishna said: (Fri, Sep 23, 2011 02:58:56 PM)    
 
But enum will store's integer constants only. How it can store all types of datatypes.

Prabhu said: (Sat, Sep 24, 2011 03:31:26 PM)    
 
What is union ?

Raju Naidu said: (Fri, Oct 28, 2011 12:41:36 PM)    
 
Structure,union,enum all are userdefined datatypes.

Let we take one senario for structure.

Suppose in my programm i've to take the 100 variables. If you want to define many variables of different datatype, instead of declaring all those variables individually just go through sructure.Just define the one structure and take all those variables into that structure.

Then if you want to access any variable, just take the structname and dot operator and variable name.then we can access those variables.

union also used for storing the different datatypes variables. But there is small difference between structure and union.i.e
In structures we can acess all those variables at a time because of they are sharing different memory locations.

But in unions whatever we declare in the union those all are sharing same memory that's why at a time we can access only one variable. enum also used for storing user defined variable

Ex: enum { married,divorced,unmarred}

By defaultley married is indexed by o,divorced is 1, unmarried is 2.

If you want to change this order you can change by using married=10 then divorced = 11, unmarried = 12.

Saravanan said: (Sun, Dec 4, 2011 11:37:58 PM)    
 
Nice Explanation raju.......

Vinaysan said: (Thu, Dec 8, 2011 11:27:43 PM)    
 
I agree with runs. He/she said very nice defnition. And one more is the main difference between structure and union is

Structures allocates diffrent memory locations.

Union allocates large memory.

Jithin James said: (Mon, Dec 19, 2011 11:47:46 AM)    
 
Can anyone explain more about Enum....plz

Reshmi Singh said: (Thu, Dec 22, 2011 04:44:01 PM)    
 
Nice explanation raju. Enum is basically used for storing different datatypes variables. It is follow indexes like{0, 1, 2, . }.

Rohit8421 said: (Fri, Jan 13, 2012 10:19:23 PM)    
 
I'm agree that structures and union are use to define new data type , but how enumeration is use to define new data type. it just internally store an integer value.

Write your comments here:
Name *:     Email:


© 2008-2011 by IndiaBIX™ Technologies. All Rights Reserved | Copyright | Terms of Use & Privacy Policy

Advertise     Contact us: info@indiabix.com     Follow us on twitter!