Truncating integer

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?ISO-8859-1?Q?VonT=F6ppel?=

    Truncating integer

    Hi!
    Is there a simple way to drop numbers from integer value with string
    formatting? Here's my problem:

    int year = 2008;
    printf("%02d", year);

    It now prints "2008", but I would like it to print just "08". I could
    subtract 2000 from the orginal value but I was wondering whether there's
    another, more beutiful way to solve this.
Working...