Class 18: Assorted Topics Flashcards
What holds for any data type <DT>
If you use the & operator on a variable of data type <DT> then the data type of the result is <DT>+ *
What happens is you use * operator on a variable of data type <DT>
The data type of results is <DT>-*
Int a; <DT> = int
&a. <DT> +*
Can a be dereferenced?
No because data type does not contain *
Int *a <DT> = int *
&a. <DT> + *
a. <DT> -
Example problem
Little median
Least significant byte is stored first in memory
Consider the structure
Struct prob{
Int k;
Int j;
Int a[2];
Int *p;
};
What is the size of this struct?
Two 4-byte values (int)
A two-element array of type in
8 byte integer pointer for a total of 24 bytes
Union
All field reference same block of memory rather than different blocks
Size of this union
Union {
Int b;
Char y[4];
}
Size of union is 4 bytes
How do we get size of union
The size of union is taken according to the size of the largest member in union
Big Endian
Most significant byte is stored first in memory