# **[](https://en.cppreference.com/w/c/header/locale)** controls culture-specific formatting: decimal separators, currency symbols, sorting order. By default programs run in the `"C"` locale (ASCII, `.` decimal); call `setlocale(LC_ALL, "")` to use the user's environment locale. Be careful with `LC_NUMERIC`—changing the decimal separator can break parsing of machine-generated data. ## Example This example demonstrates how locale affects number formatting. ```c // compile: gcc -o localeexample localeexample.c // run: ./localeexample // description: show how locale affects formatting #include #include int main() { double pi = 3.141592; setlocale(LC_ALL, "C"); printf("C locale: %f\n", pi); setlocale(LC_NUMERIC, "de_DE.UTF-8"); printf("German locale: %f\n", pi); return 0; } ```