Environment Variables

Question : Implement a program to find the environment variables using nasm and gcc library.

Environment Variables: Environment variables are those values that can affect or give info about the running of the process and so on. In linux if you need to see the details we have the command :

$ printenv
The list of environment variables involved in the process running in my system.

Basically, this gives and o/p like below:

Find environment variables in a C Program:

 #include<stdio.h>

 int main (int argc, char *argv[], char *envp[] ) {

 	int i;

 	for (i = 0 ; envp[i] != NULL ; i ++) {

 		printf("%s\n", envp[i]);

 	}

 }

Finding environment variables in nasm. Before doing that first we are going to try out the following command:

$ ./a.out Hello
Hello

If this works, then it will quiet easy for us to print the next