You are on page 1of 7

Data types:

If you know how to write a declaration statement(i.e. int


a;), you would probably know that the declaration
statement is used to tell the data type of an identifier to
the compiler before its use.
In C lang. data types are classified as:

1)Primary data type(primitive data types)


i) Integer(int)
ii) Character(char)
iii) Single-precision floating point(float)
iv) Double-precision floating point(double)
v) No value available(void)
2)Secondary data types
i)Array type
ii) Function type
iii)pointer Type
iv)Structure
v) Union
vi) Enumeration
Expressions
 An a expression is made up of one or more operands.

 The simplest form of an expression consist of single


operand. i.e. 3. But this is not meaningful.

 A meaningful expression consists of one or more


operands and operators that specify the operations to
be performed on operands.
For example: a=2+3 a meaningful expression which
involves three operands, namely a,2 and 3 and two
operators i.e. : = and +
• A expression that has only one operator it
knows as simple expression.
For example :2+3
• While an expression that involves more than
one operator is called compound expression.
For example :b = 2+3*5
Operator Associativity
• If two operators in an expression have the same
precedence level, they are evaluated from
left-to-right or right-to-left depending on their
associativity.
• For example, additions associativity is left-to-
right, so the expression 2+3+4 is evaluated as
( 2 + 3 ) + 4.

• In contrast, the assign operators associativity


is right-to-left; so the expression x = y = z
is evaluated as x = ( y = z)
Operator precedence and associativity

You might also like