470,826 Members | 1,788 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,826 developers. It's quick & easy.

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.
Jun 28 '08 #1
0 884

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by qazmlp | last post: by
5 posts views Thread by VISHNU VARDHAN REDDY UNDYALA | last post: by
4 posts views Thread by ken | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.