For a project that I am working on had to come up with a simple way to move argv/argc into a function for use with geopt in c.

This site has a great breakdown of how to build getopt  C: getopt Example

 Now I am looking at pushing it into a function to make the code more modular and below is  a quick prep moving argv and argc outside of main.

#include <stdio.h>

char **global_argv;
int global_argc;
int f(){
printf("%s %d  n", global_argv[0],global_argc );
}
int main(int argc, char *argv[]){
  global_argv = argv;
  global_argc = argc;
f();
}