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
- Amara's sum, walked with a pointer
- An array's name is the address of its first box
- a[i] and *(a + i) are the same box
- In a parameter list, int a[] is int *a
- Where an array and a pointer differ
- The index of a found box, by subtraction
- strchr and strstr, read properly at last