CS 102
[Schedule] [Examples] [Programs] [Notes & Reference] [Syllabus] [Lab & TA] [Tests] [Grades]

Pointers

Introduction, Examples, Dynamic Arrays

Introduction

We've already seen some examples using pointers as we studied strings. This elaborates on those examples.

Examples

ptr0.c: first example of pointers

ptr1.c: pointer to array element goes out of bounds

ptr2.c: manipulate array elements using pointers

pArray.c: Reference an array using pointers on the left-hand-side of an assignment statement.

 

parameters.c: Show how array notation and pointers can be used interchangeably

parametersCPP.c: c++ program illustrating mixing pointers and arrays

referenceToPointer.c: Show how pointers themselves can be reference parameters

Dynamic Arrays

Pointers are also used in creating dynamic arrays, where we may not know the size of the array ahead of time

 


[CS Dept] [UIC] [Prof. Reed]