• Integer is signed.so for n bits it stores 2^n-1 -1 to -2^n-1
• Unsigned can be used so that we can store from 0 to 2^n – 1.
• Thus for 16bits we have -32768 to 32767
• Typedef is like giving new names for int etc.
• Enum makes new types which can have fixed values given in braces eg. Enum day {mon,tue…..}
Here day can store any mon tue etc

• In storage normal use is auto
• Register makes variable local and saves in a register (you cannot lookup address of a register variable)
• Static makes it available even after control is transferred to the calling function
• Extern makes it available to all the functions of the file

• In making constants use define
• No use of ; ,all constants must be capital, no symbols except _
• And no =………eg #define MAX 20

• Declaring a value as const makes it unchangeable
• Volatile makes it changeable by external sources
• Using both it can be only changed externally

• Sizeof() is a operator and not a function

• In printing numbers %wd is used where w specifies field width. And numbers are filled from left and if %-wd then from right.

• In using float %w.pf is used where w is same and p denotes the no. of no.s after decimal

• In strings %w.ps is used where p denotes that only first p characters are to be printed.

• In a multi-dimensional array the elements are stored in a line in memory and can be accessed using pointers . a[i][j]=*(&a[0][0]+i*m+j)

• A structure is used to make use of something similar to objects

• In a structure a pointer can be used to refer to individual elements using ptr->elem.
• In union though declaration is similar to structure but memory is assigned of the size of the largest unit declared. And a union can have the value of only one type at a time.

Advertisements