I think the best approach is to introduce 1 concept at a time. You don't need to 100% explain arrays in the first module. You can detangle almost anything by introducing 1 concept at a time.
I would teach them in this order: Arrays, Pointers, Arrays+Pointers, OtherStuff[N].
Arrays:
You can teach simple arrays first so they understand the ability to have multiple data slots accessible from a single variable name.
//The following doesn't need an understanding of pointers
int x[10];
x[0] = 5;
Pointers:
Then you can teach about pointers and how they work, starting with some simple examples:
int y = 5;
int *p = &y;
*p = 6;
printf("%i\n", y);
Make sure to give a special emphasis that a pointer is just like any other variable. It stores a memory address.
There is no need to get into the stack vs heap just yet.
Arrays+Pointers:
How to iterate over arrays with pointers:
int x[10];
x[0] = 5;
x[1] = 6;
int *y = x;
printf("%i\n", *y);//prints the first element
y++;
printf("%i\n", *y);//prints the second element
Then you can teach more complicated things...
- How to do pointer arithmetic.
- Array + i shorthand for array[i]
- Passing arrays to functions as array pointets vs pointer param + size
param
- How arrays are continuous blocks of memory
- Explain string literals, buffers, ...
- How sizeof works with pointers vs array types (pointer size vs buffer size)
- Explain more complicated concepts like allocating memory, the stack, and the heap
- Multiple levels of indirection
- References
- How multi-dimensional arrays work
- ...
Throughout all examples make heavy use of sizeof and printing addresses. It really helps to understand what's going on.