-
Can I subtract an
intvariable from along long intvariable? -
In case I can’t: I need to store a bigger number than a number that can stored in a
int, and I don’t want to use adoubleorfloatbecause I need integers, what can I do? I don’t want to use alllong long int. Is there a way to cast theintinto along long intso that I can make the subtraction?
Can I subtract an int variable from a long long int variable? In case
Share
Yes you can. The
intwill be converted by the usual arithmetic conversions to along long intfor the sake of the subtraction, so that both operands have the same integer conversion rank, and the result will also be along long int.This is covered by §5/9:
The rank of
long long intis greater than the rank ofint.