Interview answers verified by specialists.

Find interview questions and answers on this website:

See right interview answers on 30 common job interview questions

What is a "locale"?

A locale is a description of certain conventions your program might be expected to follow under certain
circumstances. It's mostly helpful to internationalize your program.

If you were going to print an amount of money, would you always use a dollar sign? Not if your program
was going to run in the United Kingdom; there, you'd use a pound sign. In some countries, the currency
symbol goes before the number; in some, it goes after. Where does the sign go for a negative number? How
about the decimal point? A number that would be printed 1,234.56 in the United States should appear as
1.234,56 in some other countries. Same value, different convention. How are times and dates displayed? The
only short answer is, differently. These are some of the technical reasons why some programmers whose
programs have to run all over the world have so many headaches.

Good news: Some of the differences have been standardized. C compilers support different "locales,"
different conventions for how a program acts in different places. For example, the strcoll (string collate)
function is like the simpler strcmp, but it reflects how different countries and languages sort and order
(collate) string values. The setlocale and localeconv functions provide this support.

Bad news: There's no standardized list of interesting locales. The only one your compiler is guaranteed to
support is the "C" locale, which is a generic, American English convention that works best with ASCII
characters between 32 and 127. Even so, if you need to get code that looks right, no matter where around
the world it will run, thinking in terms of locales is a good first step. (Getting several locales your compiler
supports, or getting your compiler to accept locales you define, is a good second step.)

Do you know that?

Step away from your computer and get some sunlight. Next


Getting payments for Freelancers
1. Read how to register and get earned money

2. Open account within 5 minPayoneer sing up to get free $25