What happens when I multiple an int by a long, is the result an long or an int?
Depends, what did you declare your answer variable to be?
int answer
a * b = answer
would result in an integer answer
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);
With a long as one of the operands, the Microchip C compiler will do a 32-bit multiplication. The result will be a long.