Numeric separator syntax: Difference between revisions
Added C implementation
Catskill549 (talk | contribs) |
(Added C implementation) |
||
Line 38:
</pre>
=={{header|C}}==
locale.h provides Localization functions and is part of the C Standard Library. Separating digits in code text is not possible.
<lang C>
#include <locale.h>
#include <stdio.h>
int main()
{
unsigned long long int trillion = 1000000000000;
setlocale(LC_NUMERIC,"");
printf("Locale : %s, One Trillion : %'llu\n", setlocale(LC_CTYPE,NULL),trillion);
return 0;
}
</lang>
Output :
<pre>
[pi@raspberrypi:~/doodles $ ./a.out
Locale : C, One Trillion : 1,000,000,000,000
</pre>
=={{header|Factor}}==
Factor allows the comma <code>,</code> as a separator character in number literals.
|