/*
 * Convert a 9 digit int to a 9 element int array.
 */
int populate_array(int sin, int *sin_array) {
    // checking length of the given int
    int digits = 0;
    // going through the number and counting digits
    while(sin != 0) {
        sin = sin / 10;
        digits++;
    }
    // return 1 if the given integer is not 9 digits
    if(digits != 9) {
        return 1;
    }
    // given integer is 9 digits, so create the array
    *sin_array = malloc(sizeof(int) * 9);
    // adding digit into array
    for(int i = 0; i < 9; i++) {
        sin_array[i] = sin % 10;
        // removing the digit from the number
        sin = sin / 10;
    }

    return 0;
}
Convert a 9 digit int to a 9 element int array.