getenv function(Get Environment String) in C Language – example and detail

In the C Programming Language, the getenv function searches the environment list for the working gadget 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 surroundings list.

Returns

The getenv feature returns a pointer to the string related with title from the operating system’s environment list. If no match is found, the getenv characteristic 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:

system function <stdlib.h>