I'm taking a programming class in C, and I've run into a bug I can't solve no matter how hard I try.

The program instructs me to:
"Ask the user for the first 12 digits of an EAN number, then calculate the 13th "security" digit by performing the following operations:

Add the second, fourth, sixth, eighth, tenth, and twelfth digits
Add the first, third, fifth, seventh, ninth, and eleventh digits
Multiply the first sum by 3 and add it to the second sum
Subtract 1 from the total
Compute the remainder when the adjusted total is divided by 10
Subtract the remainder from 9

I'm coming from Python, so the easiest way to split the number into it's individual digits is to convert it to a string and then revert each element in the character array to an int stored in an integer array.

Here's my code so far:

```
#include <stdio.h>

int main(void)
{
    long ean;       //creates variable to store a 12 digit integer
    int digits[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; //initializes a 1x12 integer array
    printf("Please enter the first 12 digits in your EAN: ");
    scanf_s("%ld", &ean);   //collects the appropriate user input and stores it in ean
    char seperated[12];     //creates character array
    **sprintf_s(seperated, "%ld", ean); //converts the long integer ean to a string called separated
    for (int i = 0; i < 12; i++)
    {
        sscanf_s(seperated[i], "%d", &digits[i]);   //iterates through the characters and converts each one to an integer
                                                    //stored in the array created earlier
        printf("%d\n", digits[i]);
    }
    int sumEvens = digits[1] + digits[3] + digits[5] + digits[7] + digits[9] + digits[11]; //sums the even digits
    int sumOdds = digits[0] + digits[2] + digits[4] + digits[6] + digits[8] + digits[10]; //sums the odd digits

    int total = (3 * sumEvens + sumOdds)-1;     //multiplies the first sum by 3 and adds it to the second sum, 
                                                //then subtracts one from the total
    int securityDigit = 9 - (total % 10);   //Computes the remainder when the total is divided by 10 and subtracts that from 9
    return 0;
}

```

The problem is, my sprintf statement (marked with \*\*) is throwing an exception saying

```
Exception thrown at 0x0FB7373A (ucrtbased.dll) in ECE1400_2.exe: 0xC0000005: Access violation reading location 0xBE991A6D.

```

Does anyone know what I'm doing wrong and how I can fix it? I hope it's just something little, but I've been staring at this and researching for well over 2 hours.