Multiple choice technology programming languages

A client has asked you to write some basic accounting software in C. What data type is best for representing figures in dollars and cents?

  1. Float

  2. Double

  3. Integer

  4. Boolean

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

For representing monetary values like dollars and cents, integers are the best choice. Floating-point types like float and double can introduce rounding errors due to binary representation issues. Using integers (in cents) avoids precision problems entirely.