Programming in C

Lecture 6: POINTERS AND ARRAYS (1)

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

Next Lecture: Pointers and Arrays (2)


Lecture Outline

Aims and Objectives
Pointers and Addresses
The Organisation of Memory
Pointers and Arrays
2-dimensional character Arrays
Managing Memory
Arrays and Memory Manipulation


Aims and Objectives


Pointers and Addresses


The Organisation of Memory


Pointers and Arrays


2-dimensional character Arrays


Managing Memory


Arrays and Memory Manipulation

     array[0]         ------------->      "January"           
     array[1]         ------------->      "February"      
     array[2]         ------------->      "March"        

Some useful examples...

Pointer to int
Sizes of variables and pointers
Pointers and character arrays
Pointer to long pointing to short int
Array abstraction for element location in memory
Examples of correct/incorrect uses of pointers
Using and freeing memory
More fun things...
Using pointer to void...
Passing different data types to the same function through the same argument using void


Next Lecture...

Pointers and Arrays (2)