I'm aware of a few good options:
Big integers (e.g., int64_t, mpz_t, any bignum lib) to represent cents or 10-n cents—say, an integer represents 1/100 of a penny ($1.05 == 10500). This is called a scaled integer.
Packed BCDs (binary coded decimals) is a more esoteric method that seemed popular in old software. Read more about it.
In production code for banks (or credit cards, ATMs, POS systems), what data type is actually used the most? I'm especially asking those who worked for banks.
EDIT: Super useful links for those with the same problem domain (needing to implement a "money" data structure that doesn't break).
EDIT for the fellow who said this is a duplicate question: This is a practical not a theoretical question of "what's the best". Read the unedited title of my question. I'm asking what people have seen first-hand in banks' codebases.
I know BigDecimal is "best" obviously, but nice APIs like that aren't available everywhere, believe it or not, and decimal libraries are expensive as opposed to ints.