I wrote a function to generate one random number and I am unable to compile with gcc. I cannot find an error in my syntax and therefore assume that the error is something that I do not know is illegal.
#include <stdio.h>
#include <stdlib.h>
int rand_gen(void);
int main(void) {
int value = rand_gen(void);
printf("The random number generated was %d", value);
return 0;
}
int rand_gen(void) {
int r, x;
printf("Please seed the random number generator: ");
scanf("%d", &x);
srand(x);
return r = rand(x) % 20;
}