totn C Functions

C Language: getenv function
(Get Environment String)

In the C Programming Language, the getenv function searches the environment list for the operating system and returns a pointer to the string associated with name.

Syntax

The syntax for the getenv function in the C Language is:

char *getenv(const char *name);

Parameters or Arguments

name
The string to find in the operating system's environment list.

Returns

The getenv function returns a pointer to the string associated with name from the operating system's environment list. If no match is found, the getenv function will return a null pointer.

Required Header

In the C Language, the required header for the getenv function is:

#include <stdlib.h>

Applies To

In the C Language, the getenv function can be used in the following versions:

  • ANSI/ISO 9899-1990

Similar Functions

Other C functions that are similar to the getenv function: