I store four numbers in my array, 00,11,22,33
. When I generate a random number and print it, it displays 0
rather than 00
(when the first element is selected). The other numbers are fine and displaying correctly. How can I store 00 in an array so that it displays properly?
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
srand(time(NULL));
int myArray[4] = { 00,11,22,33 };
int randomIndex = rand() % 4;
int randomIndex1 = rand() % 4;
int randomIndex2 = rand() % 4;
int randomIndex3 = rand() % 4;
int randomValue = myArray[randomIndex];
int randomValue1 = myArray[randomIndex1];
int randomValue2 = myArray[randomIndex2];
int randomValue3 = myArray[randomIndex3];
printf("= %d\n", randomValue);
printf("= %d\n", randomValue1);
printf("= %d\n", randomValue2);
printf("= %d\n", randomValue3);
return(0);
}