Environment Variables

(First program)
Line 7: Line 7:
  
 
Find environment variables in a  C Program:  
 
Find environment variables in a  C Program:  
 +
<source>
 
  #include<stdio.h>
 
  #include<stdio.h>
  
Line 20: Line 21:
  
 
  }
 
  }
 +
</source>
 
Finding environment variables in nasm
 
Finding environment variables in nasm

Revision as of 08:27, 26 January 2017

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