Programming in C

Lecture 3: TYPES, OPERATORS AND EXPRESSIONS

CHRIS STAFF
Dept. of Computer Science and Artificial Intelligence
University of Malta

Next Lecture: Control Flow


Lecture Outline

Aims and Objectives
Data Types and Sizes
Constants
More on Declarations
Arithmetic, Relational and Logical Operators
Type Conversions
Bitwise Operations


Aims and Objectives


Data Types and Sizes

Long and Short Integers and doubles

short int - typ. shortest int supported
long int - typ. longest int supported
long double - extended-precision

Example of size reporting program

Signed and Unsigned Characters and Integers

unsigned long
signed double
signed char


Constants

Integer Constants

Character Constants

String Constants

"Hello, I am a string constant"


More on Declarations

extern.c


Arithmetic, Relational and Logical Operators

Arithmetic Operators

Relational Operators

Logical Operators


Type Conversions

Forcing Type Conversion


Bitwise Operations


Exercises


Next Lecture...

Control Flow