Created
December 2, 2016 00:16
-
-
Save valbaca/4dd7a123ace1cfe562b77fd12d2a51c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char cId[5]; | |
if (id < 10) { | |
sprintf(cId, "000%d", id); | |
} else if (id < 100) { | |
sprintf(cId, "00%d", id); | |
} else if (id < 1000) { | |
sprintf(cId, "0%d", id); | |
} else { | |
sprintf(cId, "%d", id); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment