Re: newbie C question

From: Christopher M. Ryan (drizzt@VISI.NET)
Date: 07/13/97


>should it be:   (int)(GET_LVL(ch) / 10) + 1;
>or should it be:(int)(GET_LVL(ch)) / 10 + 1;

I would use the first one because '(int)' would apply to 'GET_LVL(ch) / 10'
thereby making it an int instead of a floating point then adding 1 to it.
If i remember correctly to (i don't do to much typecasting;) the second
example you have only tells it to make 'GET_LVL(ch)' and int then devide by
ten leaving you with a float then adding 1 to it. This isn't a bad thing
because the value would be converted to whatever type it was that you were
using to store the value. It also depends on what it is you are trying to
do.

Hope this helps.

Chris the wanna be creator.


      +-----------------------------------------------------------+
      | Ensure that you have read the CircleMUD Mailing List FAQ: |
      |   http://cspo.queensu.ca/~fletcher/Circle/list-faq.html   |
      +-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST