#include <stdio.h>

int main(void) {
	int numbers[8] = { 35, 8, -5, 0, 1, 102, 73, -21 };
	int *pointers;

	printf("%d is located at %p\n", numbers[0], &numbers[0]);
	printf("prefixing a variable with &, will give the address in memory of that variable\n\n");

	pointers = &numbers[0];

	printf("%d is located at %p\n", *pointers, pointers);
	printf("prefixing a pointer with * will dereference it, giving you the value at that memory location\n");
	printf("instead of the memory location itself\n\n");

	for (int i = 0; i < 8; i++) {
		printf("%d, at %p\n", numbers[i], &numbers[i]);
		printf("%d, at %p\n", *(pointers + i), pointers + i);
	}

	printf("\nto access elements after 0 in an array using the pointer\n");
	printf("we use the form *(pointer + offset) - which basically means add the offset to the address,\n");
	printf("THEN dereference it\n");

	return 0;
}
