|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
int times long?
What happens when I multiple an int by a long, is the result an long or an int?
|
|
#2
|
||||
|
||||
|
Re: int times long?
Depends, what did you declare your answer variable to be?
int answer a * b = answer would result in an integer answer |
|
#3
|
|||
|
|||
|
Re: int times long?
I can never remember this, and my K&R is back at school.
int A; long B; int answerint; long answerlong; I think having a long in the expression casts it to long: A * B produces a long. But to be sure you can cast it: answerlong= (long) (A * B); |
|
#4
|
|||||
|
|||||
|
Re: int times long?
With a long as one of the operands, the Microchip C compiler will do a 32-bit multiplication. The result will be a long.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Lap Times | Dgrez | Rules/Strategy | 11 | 01-02-2008 12:50 |
| L.A. Times Article | Greg Ross | Dean Kamen's Inventions | 25 | 26-07-2002 22:00 |
| IRI Good Times | archiver | 2001 | 3 | 24-06-2002 04:05 |
| NY TIMES ARTICLE | SkitzoSmurf | Chit-Chat | 1 | 18-04-2002 14:42 |
| Competition Times | Pengiun Joe | Off-Season Events | 1 | 12-11-2001 18:11 |