Skip to content

Instantly share code, notes, and snippets.

@PedroRacchetti
Created September 8, 2020 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PedroRacchetti/8f754b6b48ac89aec69d120521cebcae to your computer and use it in GitHub Desktop.
Save PedroRacchetti/8f754b6b48ac89aec69d120521cebcae to your computer and use it in GitHub Desktop.
inline void print(int n){
if (n == 0)
{
putchar_unlocked('0');
putchar_unlocked('\n');
}
else if (n == -1)
{
putchar_unlocked('-');
putchar_unlocked('1');
putchar_unlocked('\n');
}
else
{
char buf[11];
buf[10] = ' ';
int i = 9;
while (n)
{
buf[i--] = n % 10 + '0';
n /= 10;
}
while (buf[i] != ' ')
putchar_unlocked(buf[++i]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment