Skip to content

Instantly share code, notes, and snippets.



Last active Oct 24, 2017
What would you like to do?
/*** printenv.c ***/
// Description
// printenv - print the environment to stdout
// Synopsis
// printenv
// Build
// $ gcc -o printenv printenv.c
#include <stdio.h>
int main(int argc, char* argv[], char* envp[]) {
for (int i = 0;; ++i) {
char* p = envp[i];
if (p == NULL) break;
printf("%s\n", p);
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.