I was watching a tutorial yesterday and i got this code which has helped me tremendiousley considering almost every program i want to build needs some randomizing.
1 2 3 4 5 6 7 8 9 10 11 12
time_t T;
time(&T);
srand(T);
int x;
int y;
for(int R = 0; R <1; ++R)
{
x = rand() % 10;
y = rand() % 50;
}
What is time_t???
why is & in front of T?
do i even need srand(T) there?
_In my case typedeflong time_t;
_& will take the address of the operand. time() comes from the C library, as you may know there were no references there. So in order to modify an argument you pass its address to the function.
_RTFM