#include<stdio.h>
#include<stdlib.h>

void myGetenv (const char * name)
{
    char * value = getenv (name);
    if (! value) {
        printf ("%s is not set.\n", name);
    }
    else {
        printf ("%s = %s\n", name, value);
    }
}

int main(int argc, char* argv[], char* evnp[]) {
	
    // Variable is not set. 
    myGetenv ("myVar");

    setenv ("myVar", "TestVal", 0);
    myGetenv ("myVar");
    // This doesn't change the value because "overwrite" is 0. 
    setenv ("myVar", "SecondValue", 0);
    myGetenv ("myVar");
    // This changes the value because "overwrite" is 1. 
    setenv ("myVar", "SecondValue", 1);
    myGetenv ("myVar");
}