One of them is signed, the other is unsigned.
it is not necessary to have same size for all members in an union ..because unions holds different data types..
The people who create the language take the liberty of deciding the size of data types in a programming lanauage.If you (as a programmer) create your own custom data type, for example by defining a class, then you decide what goes into it - for example, in Java, if one of the pieces of data requires an integer, you have the choice of storing it as an int, which uses 4 bytes, or as a long, which uses 8 bytes (and permits larger numbers).
byte
A data type that can store integer numbers. The details vary depending on the programming language; many language have different integer types to accomodate different sizes. This lets the programmer use a smaller size (and save memory space) when he only needs to store fairly small numbers - and especially when he needs to store LOTS of fairly small numbers, as in an array. Common sizes include 1 byte, 2 bytes, 4 bytes and 8 bytes of storage.
sizeof is your friend.
it is not necessary to have same size for all members in an union ..because unions holds different data types..
arrays in C are the data types which have collection of same type of data together store a fixed-size s of elements .
it is not necessary to have same size for all members in an union ..because unions holds different data types..
The people who create the language take the liberty of deciding the size of data types in a programming lanauage.If you (as a programmer) create your own custom data type, for example by defining a class, then you decide what goes into it - for example, in Java, if one of the pieces of data requires an integer, you have the choice of storing it as an int, which uses 4 bytes, or as a long, which uses 8 bytes (and permits larger numbers).
The data path size for a 64-bit processor is 64 bits. This means it supports memory addresses, integer sizes and data paths that are 8 octets wide.
byte
Importance of union in 'C':unions are the concept borrowed from structures in structures we allow different datatypes in which each datatype is allocated a separate memory location .But in unions same as structures we use different data types but all the datatypes will be allocated to a single memory location and only one datatype with maximum size will be used for allocation of all the data types used in a union program.Sample code for union is as follows:union item {int m;float c;char x;}code;In the above program we used three kinds of datatypes here integer size is 4 so the other data types will be shared in the same location of size 4.then the memory will not be wasted and all the memory will be utilized perfectly.
memory allocation has two types : static and dynamic 1) the static are for the data types that will never change in size during the program execution suxh as integers (1 and 1000 will take the same size if we declare them to have the same type). 2) while another data types such as arrays and lists , will grow and shrink during execution time (due to the addition and removing) . the HEAP is the part of the memory where such data (in part 2) are allocated.
An integer is any number, and since there are an infinite amount of numbers, the size of an integer is unlimited.
Importance of union in 'C': unions are the concept borrowed from structures in structures we allow different datatypes in which each datatype is allocated a separate memory location .But in unions same as structures we use different data types but all the datatypes will be allocated to a single memory location and only one datatype with maximum size will be used for allocation of all the data types used in a union program.Sample code for union is as follows: union item { int m; float c; char x; }code; In the above program we used three kinds of datatypes here integer size is 4 so the other data types will be shared in the same location of size 4.then the memory will not be wasted and all the memory will be utilized perfectly.
A data type that can store integer numbers. The details vary depending on the programming language; many language have different integer types to accomodate different sizes. This lets the programmer use a smaller size (and save memory space) when he only needs to store fairly small numbers - and especially when he needs to store LOTS of fairly small numbers, as in an array. Common sizes include 1 byte, 2 bytes, 4 bytes and 8 bytes of storage.
the size of an integer is determaind by using the function "sizeof(c)",here 'c' is any integer.