CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

rand() function not working?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
picj1984



Joined: 01 Mar 2010
Posts: 73

View user's profile Send private message

rand() function not working?
PostPosted: Wed Jul 07, 2010 6:33 pm     Reply with quote

Compiler version 4.109

Hi, at the risk of being embarrassed... I can't figure out why my program with rand() function won't compile.

Here is the error:

*** Error 76 "SeekWah.c" Line 541(19,20): Expect ;

and line 541 is.....

Code:


counter = rand();


counter is an unsigned char.

Doesn't get much simpler than this right? Anybody got any idea why I'm getting an error here? compiler bug?

Thanks
newguy



Joined: 24 Jun 2004
Posts: 1909

View user's profile Send private message

PostPosted: Wed Jul 07, 2010 6:40 pm     Reply with quote

A line before that is missing a ;
picj1984



Joined: 01 Mar 2010
Posts: 73

View user's profile Send private message

PostPosted: Wed Jul 07, 2010 6:50 pm     Reply with quote

well, I'm sufficiently embarrassed. I had made a definition "rand" so that was the issue.
Abdulla M.A.



Joined: 28 Mar 2010
Posts: 30
Location: Baghdad, Iraq

View user's profile Send private message Visit poster's website Yahoo Messenger

PostPosted: Thu Jul 08, 2010 10:23 am     Reply with quote

Did you set the value of "seed" and initialized the random number
generator "srand"???

Abdulla
_________________
"A scientist can discover a new star, but he cannot make one. He would have to ask an engineer to do that."
"For an optimist the glass is half full, for a pessimist it's half empty, and for an engineer is twice bigger than necessary."
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group