Command Doesn't Show Description

im making c code in linux and im having problems with one command, id should bring up a list but instead id doesnt do nothing, there are no error's, can anyone solve whats wrong ?

void environ()
{
  extern char **environ;
  int i=0;

  for (i = 0; environ !=NULL;i++)
  {
    printf(environ);
    printf("\n");
  }
}

i dont get any indents in the code... it says there are no errors.. but yet when i compile it and type in environ the next line just asks for another command and it shouldnt do that, it should display a list first.

Something like this should work:

#include <stdio.h>
#include <stdlib.h>

extern char **environ;

void env()
{
  int i=0;

  for (i = 0; environ !=NULL;i++)
  {
    printf(environ);
    printf("\n");
  }
}

main()
{
  env();
}

---------- Post updated at 14:23 ---------- Previous update was at 14:08 ----------

Not noticed that you've posted this in the homework section. Please follow the rules regarding homework questions:

Thread closed.