Brandon Barker, Ben Trumbore (revisions)
Cornell Center for Advanced Computing

Revisions: 9/2022, 8/2021, 9/2014, 2011 (original)

It is often necessary to work with collections of primitive data elements in a program, and C provides mechanisms for doing this with sequential sets of elements (arrays) and higher order combinations of elements (structs). Both can be tracked and manipulated using using references called "pointers".

Objectives

After you complete this segment, you should be able to:

  • Define the term array
  • Describe how pointers can be assigned to the addresses of array elements and then incremented in C.
  • List common mistakes programmers make using arrays and pointers in C.
  • Define a struct in C and reference the members of a struct variable, both directly and when using a pointer.
Prerequisites

There are no formal prerequisites for learning C beyond basic computer operations.

 
©   Cornell University  |  Center for Advanced Computing  |  Copyright Statement  |  Inclusivity Statement