I'm trying to get randomly a number from an array, so, I did it like this:
srand(time(NULL));
const char numbers[19] ={506001, 506002, 506003, 506004, 506005, 506006, 506007, 506008, 506009, 506010, 506011, 506012, 506013, 506014, 506015, 506016, 506017, 506018, 506019};
printf("%i",(int)numbers[rand() % 19]);
printf("\n");
But instead of giving me a number from the array it prints any other value in negative.
Also, With numbers that are short than 3 digits it works fine, the problem starts when I use 3 or more digits numbers. What am I doing bad?