I'm trying to initialize an integer array with variables that have scanned in values in C. The values in the array do not match what I scanned in. It stores weird numbers like -1040000000 or 37299 in the array instead.
Any help would be much appreciated, I'm pretty new to programming!
int num1;
int num2;
int num3;
int intarr[3] = {num1, num2, num3};
printf("Enter 3 numbers.\n");
scanf("%d", &num1);
scanf("%d", &num2);
scanf("%d", &num3);
There are no error messages, but the numbers aren't what I inputted. For example, I scanned in numbers 1, 2, 3. And when I printed out the values at each index of my array, it printed out weird numbers like I stated above.