About GBdirect Consultancy Training Development

Section navigation

Leeds Office (National HQ)

GBdirect Ltd
Leeds Innovation Centre
103 Clarendon Road
LEEDS
LS2 9DF
West Yorkshire
United Kingdom

consulting@gbdirect.co.uk

tel: +44 (0)870 200 7273
Sales: 0800 651 0338

South East Regional Office

GBdirect Ltd
18 Lynn Rd
ELY
CB6 1DA
Cambridgeshire
United Kingdom

consulting@gbdirect.co.uk

tel: +44 (0)870 200 7273
Sales: 0800 651 0338

Please note: Initial enquiries should always be directed to our UK national office in Leeds (West Yorkshire), even if the enquiry concerns services delivered in London or South/East England. Clients in London and the South East will typically be handled by staff working in the London or Cambridge areas.

2.11. Exercises

Exercise 2.17. First, fully parenthesize the following expressions according to the precedence and associativity rules. Then, replacing the variables and constants with the appropriate type names, show how the type of the expression is derived by replacing the highest precedence expressions with its resulting type.

The variables are:

char c;
int i;
unsigned u;
float f;

For example: i = u+1; parenthesizes as (i = (u + 1));

The types are

(int = (unsigned + int));

then

(int = (unsigned)); /* usual arithmetic conversions */

then

(int); /* assignment */
  1. c = u * f + 2.6L;
  2. u += --f / u % 3;
  3. i <<= u * - ++f;
  4. u = i + 3 + 4 + 3.1;
  5. u = 3.1 + i + 3 + 4;
  6. c = (i << - --f) & 0xf;