Name: _____________________ Class: CET 421
SSN/ID:   _____________________ Section & Group: ____________
Reference: environ.c


/* 
  environ - skeleton program displaying environment
  
  usage:
  
    environ
          
    displays environment with each name, value pair on a separate line

      
 ********************************************************************
   version: 1.0
   date:    December 2003
   author:  Smart Student
            sstudent@school.edu
            
   copyright (c) Smart Student, 2003. All rights reserved.
            
   This code can be used for teaching purposes, but no warranty,
   explicit or implicit, is provided.
 *******************************************************************/
 
#include <stdio.h>
#include <stdlib.h>
 
extern char **environ;                   // environment array
 
int main(int argc, char **argv)
{
    char ** env = environ;
 
    while (*env) printf("%s\n",*env++);  // step through environment
 
    exit(0);
}

 


Ricky J. Sethi <rickys at sethi.org>
Last modified: Mon Jun 6 00:48:35 PDT 2005