For example, there is an array like this ==> array[10][10]
I want to pick a random element of this array like array[5][7] and assign it to 0.
How can I do it?
Anatoly
23.2k3 gold badges33 silver badges46 bronze badges
1 Answer 1
Should be something like:
srand((unsigned) time()); // For different result every second
int x = rand() % 10;
int y = rand() % 10;
array[x][y] = 0;
answered Dec 15, 2020 at 16:48
stark
13.3k3 gold badges39 silver badges56 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-c
array[5][7] = 0;thats it.