3
votes
Accepted
implicit declaration of function 'drand48()' is invalid in c99 / generating random numbers
In order to use the function drand48() you need to:
#define _XOPEN_SOURCE /* ALWAYS BEFORE the include statement */
#include <stdlib.h>
(you don't need to worry about linking, since these ...
2
votes
Accepted
How to spawn sprite on random edge axes
You may do it in a few ways this is one of those:
https://scratch.mit.edu/projects/168643966/
1
vote
C random string generator help? cs50
This string word = ""; sets word to a "string literal", and as such it is stored in read-only memory, ie it's immutable; therefore you cannot do this word[i] = set[rand() % 52];. That's what is giving ...
1
vote
Accepted
calling srand48 rand vrs srand
Add the following line before your #include statements:
#define _XOPEN_SOURCE
1
vote
Accepted
drand48() Invalid Operands
You can't use modulus operator with doubles. It only works with integers. That is why it says "invalid operands".
Only top scored, non community-wiki answers of a minimum length are eligible