Global variables

The Microsoft C run-time library provides the following global variables or macros. Several of these global variables or macros have been deprecated in favor of more-secure functional versions, which we recommend you use instead of the global variables.

Variable Description
__argc, __argv, __wargv Contains the command-line arguments.
_daylight, _dstbias, _timezone, and _tzname Deprecated. Instead, use _get_daylight, _get_dstbias, _get_timezone, and _get_tzname.

Adjusts for local time; used in some date and time functions.
errno, _doserrno, _sys_errlist, and _sys_nerr Deprecated. Instead, use _get_errno, _set_errno, _get_doserrno, _set_doserrno, perror and strerror.

Stores error codes and related information.
_environ, _wenviron Deprecated. Instead, use getenv_s, _wgetenv_s, _dupenv_s, _wdupenv_s, _putenv_s, and _wputenv_s.

Pointers to arrays of pointers to the process environment strings; initialized at startup.
_fmode Deprecated. Instead, use _get_fmode or _set_fmode.

Sets default file-translation mode.
_iob Array of I/O control structures for the console, files, and devices.
_pctype, _pwctype, _wctype, _mbctype, _mbcasemap Contains information used by the character-classification functions.
_pgmptr, _wpgmptr Deprecated. Instead, use _get_pgmptr or _get_wpgmptr.

Based on how the program is invoked, the runtime initializes these values at program startup: either to the fully qualified or relative path of the program, the full program name, or the program name without its file name extension.

See also

C runtime library reference
Global constants
__argc, __argv, __wargv
_get_daylight
_get_dstbias
_get_timezone
_get_tzname
perror
strerror
_get_doserrno
_set_doserrno
_get_errno
_set_errno
_dupenv_s, _wdupenv_s
getenv, _wgetenv
getenv_s, _wgetenv_s
_putenv, _wputenv
_putenv_s, _wputenv_s
_get_fmode
_set_fmode