#include // pass a number to an array by reference, do math on it then return it void add(int *x) { *x = *x + 1; } int main() { int num = 0; printf("the address of int num is 0x%x\n", &num); add(&num); printf("num after add() is %d\n\n", num); printf("nexxxxxxxxxxxxxxxxxxxxxt\n"); printf("------------------------\n"); int num2 = 15; int *ptr; // integer pointer - points to an int, stores a memory address ptr = &num2; // pointer now holds the address of num printf("num2 is %d\n", num2); printf("the pointer of num2 is 0x%x\n", ptr); num2 = 20; // i is now 20 printf("num2 is now %d\n", num2); *ptr = 22; printf("num2 (*p = 22) is now %d\n", num2); add(&num2); printf("num2 passed to add() is %d\n", num2); }