Passing everything in global variables might seem convenient for this small program, but is a poor practice more generally, since it makes it hard to reason about any function in isolation. In particular, `big_array_copy`, `array_print` and `count` seem to be used only for short-term storage, so should be local to their respective functions. The functions are tightly bound to those globals, and to the particular array sizes you have chosen. If you ever want to change any of the dimensions, you'll need to re-understand the entire program to make the many changes that are required. You could save all that effort by simply writing a couple of manifest constants for the dimensions, and using them consistently. That also helps readers, who no longer need to keep referring back to the definitions to check whether the bounds are correct (and remember, your code will be read many more times than written!). It's not clear why `user_num` holds `int` values, as they get silently converted to `uint16_t`: big_array_copy[0][i] = user_num[i]; This problem could be avoided by declaring `user_num` to be an array of `uint16_t`. There's no need for `big_array_copy` - just move the items within `big_array` and then copy the new items into it: void fifo_algorithm(uint16_t const *user_num) { memmove(big_array+1, big_array, sizeof big_array - sizeof big_array[0]); memcpy(big_array[0], user_num, sizeof big_array[0]); } Not only is that much shorter than copying one element at a time to `big_array_copy` and back, it's also much less work for CPU and cache, too. The input handling is very weak - if we mistakenly provide a non-numeric input, the `scanf()` will repeatedly fail trying to parse it. It's good to see you've included a test program. You could improve on that by making the tests _self-checking_ and providing their own input. As it is, the test requires a separate input file (or even worse, manual entry of data) and it requires visual inspection of the output, both of which make it unsuitable for automated regression testing. --- # Improved code #include <inttypes.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> static void random_num_input(void); static int read_user_values(uint16_t *user_num); static void print_array(void); static void fifo_algorithm(uint16_t const *user_num); /* Global FIFO object */ #define COLS 5 #define ROWS 10 uint16_t big_array[ROWS][COLS] = { 0 }; int main(void) { random_num_input(); puts("These are the original numbers in the big array:"); print_array(); for (int count = 0; count < ROWS; ++count) { uint16_t user_num[COLS] = { 0 }; int status = read_user_values(user_num); if (status) { return status; } printf("\n\n"); fifo_algorithm(user_num); print_array(); } } // Populate the FIFO with random numbers between 0-255 void random_num_input(void) { for (int j = 0; j < ROWS; ++j) { for (int i = 0; i < COLS; ++i) { big_array[j][i] = (uint16_t)(rand() & 0xff); } } } static int read_user_values(uint16_t *user_num) { puts("Please enter values to swap in:"); for (int i = 0; i < COLS; ++i) { int status = scanf("%" SCNu16, &user_num[i]); if (status == EOF) { fputs("Failed to read input\n", stderr); return EXIT_FAILURE; } else if (status != 1) { /* discard and re-read this datum */ fprintf(stderr, "Failed to parse item %d; Re-enter last %d value(s)\n", i, COLS-i); scanf("%*[^\n]"); --i; /* repeat this scanf */ } } return 0; /* success */ } // Prints the contents of the FIFO void print_array(void) { for (int j = 0; j < ROWS; ++j) { for (int i = 0; i < COLS; ++i) { printf("%" PRIu16",", big_array[j][i]); } printf("\n"); } } // Shift a new row of data into the FIFO void fifo_algorithm(uint16_t const *user_num) { memmove(big_array+1, big_array, sizeof big_array - sizeof big_array[0]); memcpy(big_array[0], user_num, sizeof big_array[0]); }