Skip to content

Instantly share code, notes, and snippets.

@jonohayon
Created April 12, 2020 11:22
Show Gist options
  • Save jonohayon/ea288d41f67ca769ba1dae15cf7bdc26 to your computer and use it in GitHub Desktop.
Save jonohayon/ea288d41f67ca769ba1dae15cf7bdc26 to your computer and use it in GitHub Desktop.
char *octalfive(unsigned int num) {
char *repr = (char *) malloc(BINARY_REPR_LEN * num);
unsigned int len;
sprintf(repr, "%05o", num);
len = strlen(repr);
memmove(repr, repr + (len - 5), 5);
return realloc(repr, 5);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment