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.



__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.


Deprecated. Instead, use _get_fmode or _set_fmode.

Sets default file-translation mode.


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.

Initialized at program startup to the fully-qualified or relative path of the program, the full program name, or the program name without its file name extension, depending on how the program was invoked.