answersLogoWhite

0


Best Answer

Structures and unions share the following characteristics: * Their members can be objects of any type, including other structures and unions or arrays. A member can also consist of a bit field. * The only operators valid for use with entire structures and unions are the simple assignment (=) and sizeof operators. In particular, structures and unions cannot appear as operands of the equality ( == ), inequality (!=), or cast operators. The two structures or unions in the assignment must have the same members and member types. * A structure or a union can be passed by value to functions and returned by value by functions. The argument must have the same type as the function parameter. A structure or union is passed by value just like a scalar variable; that is, the entire structure or union is copied into the corresponding parameter. similarity is all three are user defined data types.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Similarities between union structure enum in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Movies & Television
Related questions

What is similarity among structure union and enum in c language?

all the three are user defined datatypes


What is the difference between array and enum?

Array is collection of data items of same data type.Enum is collection of data items of different data type.


What is similarity between a union and enumeration?

Nothing, only the syntax (very little). Eg.: struct { int foo; double bar; } strtest; enum { monday=0, tuesday=1, ... } enumtest;


Difference between enum and const in c?

members in union and enum both shares memory and the size of the union is the size of the highest element like if there is one int and one char in union then the size of union will be the size of an int. if an int and an float are there then the size of the union will be the size of the float. This is not the case in the enum. it has similar type of members. and the value of the members can be assign manually like this enum e{ZERO,ONE,TWO=20,THREE}; here ZERO will have value 0, ONE will have value 1, TWO will be having 20 , THREE will be having 21.. and so on Answer: they are no way similar, no point in comparing them.


What is the ingredients in jav enum?

Java enum is not a consumable product. Java enum is a type of computer language that allows internet users to surf the internet with more ease and makes the transition between graphics and text more fluid.


What is meant by enum in C programming?

The enum keyword means enumeration.


How do you pass enum object as argument to function in c?

You can't pass an enum as an argument to a function. An enum in C isn't an object, it's a type. All you can do is pass a variable that is of the particular enum's type.


When was Kadhal Enum Nadhiyinile created?

Kadhal Enum Nadhiyinile was created in 1989.


What is enum type?

An enum type is a type whose fields consist of a fixed set of constants


What are Java enums?

An enum, short for enumerated type, is a variable type that can only take on the values that are declared inside the enum declaration. An enum is declared like a class, except the word "class" is replaced by the word "enum", and the class body is replaced by a list of values that a variable of that type can take on. You can also include methods, instance variables, and constructors in an enum.


What is difference between C enum and C plus plus enum?

In C++, enum signifies a slightly stronger type than in C. For example, in C, one could write: enum Direction { UP, DOWN }; Direction d = 1; In C++, this would be illegal, only UP or DOWN can be assigned to a variable of type Direction, though there is still implicit casting to integer, so one could still write: int i = UP; Another difference has to do with the way variable are declared in general in C++. In C, once the enum was declared as above, declaring variables of type Direction would have to be done through the enum keyword, like this: enum Direction d = UP; In C++, the name "Direction" becomes a type in itself, so you can write: Direction d = UP;


In c plus plus you cannot assign integer value to enum?

That is correct - In c plus plus you cannot assign integer value to enum - You can only assign an enum value to an enum. Even though an enum looks like an integer, it is not. It is an enum, and C++ implements strict type checking to reduce the probability of bad programming practices. enum ColorCode {black, brown, red, orange, yellow, green, blue, violet, grey, white}; ColorCode myColorCode; myColorCode = yellow; Even though yellow has an integer value of 4, you cannot say myColorCode = 4.