a char * var = "EnvVariable"; this EnvVariable is stored in env variable example (EnvVariable="test")
now we want to get the value of EnvVariable in char *result .
when print result it will give me output of EnvVariable i.e test.
I think you are looking for this exemple :
#include <stdio.h> #include <stdlib.h> int main() { const char * path = getenv( "PATH" ); printf( "PATH environment variable == %s\n", path ); return 0; }
I think you are looking for this exemple :