Lecture 1 - Slide 20 : 34
Arrays and Pointers: Examples
Some programs that illustrate arrays and pointers in C
array-1.c
C Program with an array.
vector-0b.cc
C++ preview: Similar program with vectors - variation 1.
vector-0a.cc
C++ preview: Similar program with vectors - variation 2.
vector-0c.cc
C++ preview: Similar program with vectors - variation 3.
array-1-ptr.c
A similar C program with pointers and dynamic allocation of memory - one dimensional.
array-2.c
C Program with two a dimensional array.
array-2-ptr.c
A similar C program with pointers - two dimiensional.
array-limitations-1.c
Illustration of array limitations in C: Cannot assign.
array-limitations-1-with-for.c
A solution: Copy the array in a for loop.
array-limitations-1-memcpy.c
A solution: Copy the array with memcpy - a low-level alternative.
array-limitations-2.c
Illustration of array limitations in C: Cannot pass as value parameter.
array-limitations-3.c
Less confusing version that uses pointers.
program-output-limitations-2-and-3
Output from both of the two programs above.
Go to exercise
C Time functions from time.h