Learn C Programming

Lesson 3 of 10 · Pointers and Memory

Module 11 · Pointers and Memory

Pointers and Arrays: the Same Thing, Almost

Free with an accountReading

Amara takes her sum_of from Module 9 lesson 05 and rewrites it without an index. A pointer starts at the first mark and steps along until it passes the last. The program prints total: 237, exactly as before. Bob asks whether she found a second way to add marks. She has found the first way again: Module 9's brackets were doing this all along.

Sign in to read

This lesson is free, with an account

An account costs nothing and opens every lesson in this track that is not marked Pro, on every device you read on.

What is inside Pointers and Arrays: the Same Thing, Almost

  1. Amara's sum, walked with a pointer
  2. An array's name is the address of its first box
  3. a[i] and *(a + i) are the same box
  4. In a parameter list, int a[] is int *a
  5. Where an array and a pointer differ
  6. The index of a found box, by subtraction
  7. strchr and strstr, read properly at last