Use the setlocale() function:
By using "" (the empty string) you tell setlocale() to use system defaults, which at least on Unix-like systems will be set through environment variables. So if you set $LANG (or $LC_NUMERIC) to, say fr_FR, and use printf("%f\n", 5.5), it should output 5,5.
setlocale(LC_ALL, ""); /* sets all locale information (collation, character classification, etc) */
setlocale(LC_NUMERIC, ""); /* affects just the number formatting */
You can also pass a string (which is system-specific) as the second argument to force a particular language. This is less desirable because it doesn't allow the user to choose.