Great Question!
I will go over this in class. But here is the intuition. Hope it helps.
-- First, the visual representation in the slides in just to indicate word start and end points so that is easy to read. IT IS NOT HOW MEMORY IS ORGANIZED.
Memory is just a flat byte array.
------------------------------
Given a 64 bit system memory is just 2^64 byte array with indices 0 to 2^64 - 1. All the addresses can be accessed and touched.
The question is given a data type (e.g., int or char) where in this byte array should we allocate it i.e., what is the starting address should we assign it.
The starting address is actually related to how many bytes the data type itself requires. This is where alignment comes in.
Alignment
----------
The reason you need aligned is because only certain types of reads and writes can be efficiently performed by the underlying hardware.
Each read specifies a start address and a certain number of bytes to read. When the start address is a multiple of number of bytes to read, the access is highly efficient. This is known as aligned data.
On a 64 bit system
A char (one byte) : 1-byte aligned.
A short (two bytes) : 2-byte aligned (only even addresses. Bottom bit of address is 0).
An int (four bytes) : 4-byte aligned (only addresses which are multiples of 4. Bottom two bits of address are 0).
A long (eight bytes) : 8-byte aligned (only addresses which are multiples of 8. Bottom 3 bits of address are 0).
A double (eight bytes) : 8-byte aligned.
A long long (eight bytes) : 8-byte aligned.
Any pointer (eight bytes) : 8-byte aligned.
This means that the data's starting address is a multiple of the data size (note that is says data size. Which has nothing to do with word size.)
---------------------------------------------------------------------------
A memory access (read/wirte) is aligned if data size = n bytes long and data start address is n-byte aligned (multiple of n).
When a memory access is not aligned, it is said to be misaligned.
A pointer that refers to primitive data that is n bytes long is said to be aligned if it is only allowed to contain addresses that are n-byte aligned, otherwise it is said to be unaligned.
A memory pointer that refers to a data aggregate (a struct or array in C) is aligned if (and only if) each primitive datum in the aggregate is aligned.
A memory address a is said to be n-byte aligned when a is a multiple of n bytes
An n-byte aligned address would have a minimum of log2(n) least-significant zeros when expressed in binary.
--------------------------------------------------------------------------
I have included a new sample program under Syllabus: Week 1 : Additional notes. Int_align