Created
September 27, 2015 11:11
-
-
Save msikma/a49762d296c0367b941c to your computer and use it in GitHub Desktop.
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
// small test (compiled with DJGPP for MSDOS) | |
#include <stdio.h> | |
int main(int argc, char *argv[]) | |
{ | |
int a; | |
char *arg; | |
if (argc == 0) { | |
printf("No command line arguments.\n"); | |
return 0; | |
} | |
printf("Checking command line arguments.\n"); | |
for (a = 1; a < argc; ++a) { | |
arg = argv[a]; | |
printf("arg: %s\n", arg); | |
} | |
// crashes here: | |
printf("Checking character at index 1 of the command line arguments.\n"); | |
for (a = 1; a < argc; ++a) { | |
arg = argv[a]; | |
printf("arg: %s\n", arg[1]); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment