Skip to content

Instantly share code, notes, and snippets.

@geoghegan
Created July 16, 2018 18:59
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 geoghegan/64c00f9c42a45986579a15f3f20a3926 to your computer and use it in GitHub Desktop.
Save geoghegan/64c00f9c42a45986579a15f3f20a3926 to your computer and use it in GitHub Desktop.
Commas in C Numerals
#include <stdio.h>
#include <locale.h>
int main()
{
/*
This will print out as 999,999,999
The magic is in the %'d but you need the locale set first
*/
setlocale(LC_NUMERIC, "");
printf("%'d\n", 999999999);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment