int populate_array(int sin, int *sin_array) {
    // check if sin is 9 digits
    int count = 0;
    int num = sin;

    while (num != 0){
            count++;
            num /= 10;
    }

    if (count != 9){
            return 1;
    }

    // populate sin_array
    for (int i = 8; i > 0; i--){
        sin_array[i] = sin % 10;
        sin = sin / 10;
    }
    return 0;
}

It takes an integer and an integer array as its arguments, and returns an integer. This function's job is to populate the given integer array so that it contains the 9 digits of the given integer, in the same order as in the integer. Hint: use % 10 and / 10 to calculate the digits. The function must return 0 when it completes successfully, and 1 if the given integer is not 9 digits.