Mail Archives: djgpp/1996/11/21/01:56:41
On 20 Nov 1996, Mad wrote:
>
> i just downloaded djgpp version 2.01 and i'm having problem with the
> rand() function which always assigns 0 (zero) to my variable. For instance:
>
>
> int main (void)
> { int x;
>
> x=rand();
> return (0);
> }
>
> will always assign me 0 to x. Is anyone else haveing the same problem or am
> i the only one?
If you compile this very program, gcc might see that x is never used and
silently optimize it away. Try adding a `printf' statement that prints
the value, or put it into the return statement, and then see if it works.
- Raw text -