Scroll Down to See All
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1yn



Function Details : putenv

intputenv(char * string) ;

Return Type : int

Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
Read about return values of putenv function .

1st Parameter Type : char *

String pointer (array of characters)

1st Parameter

A pointer to a string of the format `NAME=VALUE`, where `NAME` is the name of the environment variable and `VALUE` is its value. The string must persist in memory as long as the environment variable is needed.

Read more about parameters of putenv in parameters section
The putenvfunction in C language Changes or adds a value to the environment.
The putenv function adds or changes the value of environment variables. It takes a string of the form name=value and places it in the environment list. If the name already exists in the environment, its value is changed to the new value. If the name does not exist, a new entry is created. The string passed to putenv becomes part of the environment, so altering the string after a call to putenv affects the environment.
The putenvfunction takes 1 parameter:
  • char * `string`: A pointer to a string of the format `NAME=VALUE`, where `NAME` is the name of the environment variable and `VALUE` is its value. The string must persist in memory as long as the environment variable is needed.
Adds or modifies an environment variable specified by the string `NAME=VALUE`. The function directly uses the memory pointed to by `string` without copying it, so the string must not be modified or freed while in use. Returns `0` on success or a nonzero value on failure.
The putenv function return value :
  • Returns zero on success, or a non-zero value if an error occurs

Output

This example demonstrates how to use putenv to set an environment variable and then retrieve its value using getenv.