Why should I cast time when I call srand? I've been told to do it but I don't know why. Won't the number from time be converted to unsigned automatically?
Code:#include <stdio.h> #include <stdlib.h> #include <time.h> int main(void) { int i; /* Why the cast? */ srand((unsigned)time(NULL)); for ( i = 0; i < 10; ++i ) { printf("%d\n", rand()); } return 0; }