#include // Works in C // In this version, we pass an address void swap(int *a, int *b){ int t = *a; *a = *b; *b = t; } // double_all: Doubles everthing in an array of floats // size_t is an integer that's the same size as a memory address // It's unsigned void double_all(double *arr, size_t item_count){ for(int i = 0; i < item_count; i++) arr[i] *= 2; } // Indexing: // arr[i] means *(arr + i) int main(){ int x = 24, y = 425; printf("x = %d\n", x); printf("y = %d\n", y); swap(&x, &y); printf("After Swap\n"); printf("x = %d\n", x); printf("y = %d\n", y); double numbers[] = {3.14, 2.71, 5.14, 9.2, 4.1}; double_all(numbers, 5); for(int i = 0; i < 5; i++) printf("%lf\n", *(numbers + i)); return 0; }