Skip to content

Instantly share code, notes, and snippets.

@CodeBrauer
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save CodeBrauer/65e1afe51bb41b94e329 to your computer and use it in GitHub Desktop.

Select an option

Save CodeBrauer/65e1afe51bb41b94e329 to your computer and use it in GitHub Desktop.
argv / argc example
#include <stdio.h>
int main (int argc, char *argv[]) {
int count;
printf ("This program was called with \"%s\".\n",argv[0]);
if (argc > 1){
for (count = 1; count < argc; count++) {
printf("argv[%d] = %s\n", count, argv[count]);
}
} else {
printf("The command had no other arguments.\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment