Last active
August 29, 2015 14:19
-
-
Save CodeBrauer/65e1afe51bb41b94e329 to your computer and use it in GitHub Desktop.
argv / argc example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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