# <locale.h>
<locale.h>
# ``
* * *
Include the standard header **``**
to alter or access properties of the current
**locale**
-- a collection of culture-specific information.
An implementation can define additional
macros in this standard header with names that begin with `LC_`.
You can use any of these macro names as the
**locale category** argument
(which selects a cohesive subset of a locale) to
[`setlocale`](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_locale.html#setlocale).
#define LC_ALL
#define LC_COLLATE
#define LC_CTYPE
#define LC_MONETARY
#define LC_NUMERIC
#define LC_TIME
#define NULL [0 in C++]
struct lconv;
struct lconv *localeconv(void);
char *setlocale(int category, const char *locname);Copy to clipboard
## `LC_ALL`
#define LC_ALL Copy to clipboard
The macro yields the
[locale category](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_locale.html#locale%20category)
argument value that affects all locale categories.
## `LC_COLLATE`
#define LC_COLLATE Copy to clipboard
The macro yields the
[locale category](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_locale.html#locale%20category)
argument value that affects the collation functions
`strcoll` and
`strxfrm`.
## `LC_CTYPE`
#define LC_CTYPE Copy to clipboard
The macro yields the
[locale category](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_locale.html#locale%20category)
argument value that affects
[character classification](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_ctype.html) functions,
[wide-character classification](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_wctype.html) functions,
and various multibyte conversion functions.
## `LC_MONETARY`
#define LC_MONETARY Copy to clipboard
The macro yields the
[locale category](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_locale.html#locale%20category)
argument value that affects monetary information returned by
[`localeconv`](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_locale.html#localeconv).
## `LC_NUMERIC`
#define LC_NUMERIC Copy to clipboard
The macro yields the
[locale category](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_locale.html#locale%20category)
argument value that affects numeric information returned by
[`localeconv`](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_locale.html#localeconv),
including the decimal point used by numeric conversion,
read, and write functions.
## `LC_TIME`
#define LC_TIME Copy to clipboard
The macro yields the
[locale category](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_locale.html#locale%20category)
argument value that affects the time conversion function
[`strftime`](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_time.html#strftime).
## `lconv`
struct lconv {
ELEMENT "C" LOCALE LOCALE CATEGORY
char *decimal_point; "." LC_NUMERIC
char *grouping; "" LC_NUMERIC
char *thousands_sep; "" LC_NUMERIC
char *mon_decimal_point; "" LC_MONETARY
char *mon_grouping; "" LC_MONETARY
char *mon_thousands_sep; "" LC_MONETARY
char *negative_sign; "" LC_MONETARY
char *positive_sign; "" LC_MONETARY
char *currency_symbol; "" LC_MONETARY
char frac_digits; CHAR_MAX LC_MONETARY
char n_cs_precedes; CHAR_MAX LC_MONETARY
char n_sep_by_space; CHAR_MAX LC_MONETARY
char n_sign_posn; CHAR_MAX LC_MONETARY
char p_cs_precedes; CHAR_MAX LC_MONETARY
char p_sep_by_space; CHAR_MAX LC_MONETARY
char p_sign_posn; CHAR_MAX LC_MONETARY
char *int_curr_symbol; "" LC_MONETARY
char int_frac_digits; CHAR_MAX LC_MONETARY
char int_n_cs_precedes; CHAR_MAX LC_MONETARY [added with C99]
char int_n_sep_by_space; CHAR_MAX LC_MONETARY [added with C99]
char int_n_sign_posn; CHAR_MAX LC_MONETARY [added with C99]
char int_p_cs_precedes; CHAR_MAX LC_MONETARY [added with C99]
char int_p_sep_by_space; CHAR_MAX LC_MONETARY [added with C99]
char int_p_sign_posn; CHAR_MAX LC_MONETARY [added with C99]
};
Copy to clipboard
`struct lconv` contains members that describe how to format
numeric and monetary values. Functions in the Standard C library use
only the field `decimal_point`.
The information is otherwise advisory:
- Members of type *pointer to char* all designate
[C strings](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_lib_over.html#C%20string).
- Members of type *char* have nonnegative values.
- A *char* value of
[`CHAR_MAX`](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_limits.html#CHAR_MAX)
indicates that a meaningful
value is not available in the current locale.
The members shown above can occur in arbitrary order and can
be interspersed with additional members. The comment following each
member shows its value for the
**`"C"` locale**,
the locale in effect at
[program startup](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_lib_over.html#program%20startup),
followed by the
[locale category](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_locale.html#locale%20category)
that can affect its value.
A description of each member follows, with an example in parentheses
that would be suitable for a USA locale.
**`currency_symbol`**
-- the local currency symbol (`"$"`)
**`decimal_point`**
-- the decimal point for non-monetary values (`"."`)
**`grouping`**
-- the sizes of digit groups for non-monetary values.
An empty string calls for no grouping. Otherwise,
successive elements of the string describe groups going away
from the decimal point:
- An element value of zero (the terminating null character) calls
for the previous element value to be repeated indefinitely.
- An element value of
[`CHAR_MAX`](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_limits.html#CHAR_MAX)
ends any further grouping (and hence ends the string).
Thus, the array `{3, 2, CHAR_MAX}` calls for a group of
three digits, then two, then whatever remains, as in
`9876,54,321`, while `"\3"`
calls for repeated groups of three digits, as in
`987,654,321`. (`"\3"`)
**`int_curr_symbol`**
-- the international currency symbol
specified by ISO 4217 (`"USD "`)
**`mon_decimal_point`**
-- the decimal point for monetary values (`"."`)
**`mon_grouping`**
-- the sizes of digit groups for monetary values.
Successive elements of the string describe groups going away
from the decimal point. The encoding is the same as for
[`grouping`](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_locale.html#grouping).
**`mon_thousands_sep`**
-- the separator for digit groups to the left of the decimal point
for monetary values (`","`)
**`negative_sign`**
-- the negative sign for monetary values (`"-"`)
**`positive_sign`**
-- the positive sign for monetary values (`"+"`)
**`thousands_sep`**
-- the separator for digit groups to the left of the decimal point
for non-monetary values (`","`)
**`frac_digits`**
-- the number of digits to display to the right of the decimal point
for monetary values (`2`)
**`int_frac_digits`**
-- the number of digits to display to the right of the decimal point
for international monetary values (`2`)
**`int_n_cs_precedes`**
**[added with C99]** -- whether the international currency symbol
precedes or follows the value for negative monetary values:
- A value of 0 indicates that the symbol follows the value.
- A value of 1 indicates that the symbol precedes the value.
(`1`)
**`int_n_sep_by_space`**
**[added with C99]** -- whether the international currency symbol
is separated by a space (defined by `int_curr_symbol[3]`)
or by no space from the value
for negative monetary values:
- A value of 0 indicates that no space separates symbol from value.
- A value of 1 indicates that a space separates symbol, or adjacent symbol and
sign, from value.
- A value of 2 indicates that a space separates symbol
from adjacent sign, otherwise a space separates non-adjacent sign from value.
(`0`)
**`int_n_sign_posn`**
**[added with C99]** -- the format for negative international monetary values:
- A value of 0 indicates that parentheses surround the value and the
currency symbol.
- A value of 1 indicates that the negative sign precedes the value and the
currency symbol.
- A value of 2 indicates that the negative sign follows the value and the
currency\_symbol.
- A value of 3 indicates that the negative sign immediately precedes the
currency symbol.
- A value of 4 indicates that the negative sign immediately follows the
currency\_symbol. (`4`)
**`int_p_cs_precedes`**
**[added with C99]** -- whether the international currency symbol precedes
or follows the value for positive monetary values:
- A value of 0 indicates that the symbol follows the value.
- A value of 1 indicates that the symbol precedes the value.
(`1`)
**`int_p_sep_by_space`**
**[added with C99]** -- whether the international currency symbol is separated
by a space (defined by `int_curr_symbol[3]`)
or by no space from the value for positive monetary values:
- A value of 0 indicates that no space separates symbol from value.
- A value of 1 indicates that a space separates symbol, or adjacent symbol and
sign, from value.
- A value of 2 indicates that a space separates symbol
from adjacent sign, otherwise a space separates non-adjacent sign from value.
(`0`)
**`int_p_sign_posn`**
**[added with C99]** -- the format for positive international monetary values:
- A value of 0 indicates that parentheses surround the value and
the currency symbol.
- A value of 1 indicates that the positive sign precedes the value
and the currency symbol.
- A value of 2 indicates that the positive sign follows the value
and the currency symbol.
- A value of 3 indicates that the positive sign immediately precedes
the currency symbol.
- A value of 4 indicates that the positive sign immediately follows
the currency symbol. (`4`)
**`n_cs_precedes`**
-- whether the currency symbol
precedes or follows the value for negative monetary values:
- A value of 0 indicates that the symbol follows the value.
- A value of 1 indicates that the symbol precedes the value.
(`1`)
**`n_sep_by_space`**
-- whether the currency symbol
is separated by a space or by no space from the value
for negative monetary values:
- A value of 0 indicates that no space separates symbol from value.
- A value of 1 indicates that a space separates symbol, or adjacent symbol and
sign, from value.
- **[added with C99]** A value of 2 indicates that a space separates symbol
from adjacent sign, otherwise a space separates non-adjacent sign from value.
(`0`)
**`n_sign_posn`**
-- the format for negative monetary values:
- A value of 0 indicates that parentheses surround the value and the
currency symbol.
- A value of 1 indicates that the negative sign precedes the value and the
currency symbol.
- A value of 2 indicates that the negative sign follows the value and the
currency\_symbol.
- A value of 3 indicates that the negative sign immediately precedes the
currency symbol.
- A value of 4 indicates that the negative sign immediately follows the
currency\_symbol. (`4`)
**`p_cs_precedes`**
-- whether the currency symbol precedes
or follows the value for positive monetary values:
- A value of 0 indicates that the symbol follows the value.
- A value of 1 indicates that the symbol precedes the value.
(`1`)
**`p_sep_by_space`**
-- whether the currency symbol is separated
by a space or by no space from the value for positive monetary values:
- A value of 0 indicates that no space separates symbol from value.
- A value of 1 indicates that a space separates symbol, or adjacent symbol and
sign, from value.
- **[added with C99]** A value of 2 indicates that a space separates symbol
from adjacent sign, otherwise a space separates non-adjacent sign from value.
(`0`)
**`p_sign_posn`**
-- the format for positive monetary values:
- A value of 0 indicates that parentheses surround the value and
the currency symbol.
- A value of 1 indicates that the positive sign precedes the value
and the currency symbol.
- A value of 2 indicates that the positive sign follows the value
and the currency symbol.
- A value of 3 indicates that the positive sign immediately precedes
the currency symbol.
- A value of 4 indicates that the positive sign immediately follows
the currency symbol. (`4`)
## `localeconv`
struct lconv *localeconv(void);Copy to clipboard
The function returns a pointer to a static-duration structure
containing numeric formatting information for the current locale.
You cannot alter values stored in the static-duration structure. The
stored values can change on later calls
to `localeconv` or on calls to
[`setlocale`](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_locale.html#setlocale)
that alter any of the categories
[`LC_ALL`](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_locale.html#LC_ALL),
[`LC_MONETARY`](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_locale.html#LC_MONETARY), or
[`LC_NUMERIC`](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_locale.html#LC_NUMERIC).
## `NULL`
#define NULL [0 in C++]Copy to clipboard
The macro yields a null pointer constant that is usable as an
[address constant expression](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_express.html#address%20constant%20expression).
## `setlocale`
char *setlocale(int category, const char *locname);Copy to clipboard
The function either returns a pointer to a static-duration string
describing a new locale or returns a null pointer (if the new locale
cannot be selected). The value of `category`
selects one or more
[locale categories](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_locale.html#locale%20category),
each of which must match the value
of one of the macros defined in this standard header with names that
begin with `LC_`.
If `locname` is a null pointer, the locale remains unchanged.
If `locname` designates the string `"C"`,
the new locale is the
[`"C"`](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_locale.html#C%20locale) locale
for the locale category specified. If `locname`
designates the string `""`, the new locale is the
**native locale**
(a default locale presumably tailored for the local culture)
for the locale category specified.
`locname` can also designate a string
returned on an earlier call to `setlocale` or to other strings
that the implementation can define.
At
[program startup](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_lib_over.html#program%20startup),
the target environment calls `setlocale(
LC_ALL,
"C")` before it calls `main`.
* * *
See also the
**[Table of Contents](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_index.html#Table%20of%20Contents)** and the
**[Index](https://docs.qualcomm.com/doc/80-N3040-23/topic/_c_index.html)**.
*[Copyright](https://docs.qualcomm.com/doc/80-N3040-23/topic/c_crit_pjp.html) © 1992-2006by P.J. Plauger and Jim Brodie. All rights reserved.*
Last Published: Oct 06, 2026
Previous Topic
Next Topic