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 support@ccsinfo.com

Can Somebody explain this?

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



Joined: 29 Dec 2003
Posts: 81

View user's profile Send private message

Can Somebody explain this?
PostPosted: Mon Jan 19, 2004 8:45 am     Reply with quote

Hi,

I encounter this statement from this forum and I want help for clarification:
rxin = (rxin+1) \% rxsize

Is this possible? anyone who explain this statement.

Thank u.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Mon Jan 19, 2004 9:12 am     Reply with quote

Should be
Code:

rxin = (rxin+1) % rxsize;


You have a '\' in there that should not be there.

% returns the remainder of the integer division.

This will accomplish the same and may be more clear
Code:

rxin++;
if (rxin >= rxsize)
  rxin -= rxsize;

or
Code:

rxin++;
while (rxin >= rxsize)
  rxin -= rxsize;
dvsoft



Joined: 28 Nov 2003
Posts: 46

View user's profile Send private message

PostPosted: Mon Jan 19, 2004 9:39 am     Reply with quote

Exclamation

Hello,

For the beginner in C - language


http://cm.bell-labs.com/cm/cs/cbook/
dvsoft



Joined: 28 Nov 2003
Posts: 46

View user's profile Send private message

PostPosted: Tue Jan 20, 2004 5:07 am     Reply with quote

Exclamation
Hello,

I have the impression that you do not know at all the language 'C’ It
Book K&R should be read

http://cm.bell-labs.com/cm/cs/cbook/
dyeatman



Joined: 06 Sep 2003
Posts: 1912
Location: Norman, OK

View user's profile Send private message

Explanation
PostPosted: Tue Jan 20, 2004 8:59 am     Reply with quote

For an explanation of whtathe line does see the topic below:

http://www.ccsinfo.com/forum/viewtopic.php?t=17873&highlight=


Smile
Dave
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