/* arrDemo2.c - same as arrDemo1 but this time we do file decomposition * - various forms of declaring arrays * - passing arrays to functions * - include 2 user written .h files * - breaks program into main, and library (a .h/.c file pair ) * - COMPILATION COMMAND assumes arrDemo2.c arraylib.c arraylib.h in * directory * - TO COMPILE: gcc arrDemo2.c arraylib.c * - TO EXECUTE: ./a.out */ #include #include #include "arraylib.h" /* prototypes for array functions */ int main(int argc, char *argv[]) { int a[] = { 2,3,5,7,11 }; int aLen = 5; int b[] = { 4,6,8, 12, 16 }; int bLen=5; int c[10], d[7]; printf("\nBefore array swap:\n"); printf("a = "); printArray(a, aLen); printf("b = "); printArray(b, bLen); swapArrays(a, aLen, b, bLen); printf("\nAfter swap:\n"); printf("a = "); printArray(a, aLen); printf("b = "); printArray(b, bLen); return EXIT_SUCCESS; }