Last active
December 31, 2015 16:59
-
-
Save mzyy94/8017103 to your computer and use it in GitHub Desktop.
Segmentation faultとBus errorを再現するためのもの
This file contains 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
int main(int argc, char* argv[]) { | |
unsigned char c[1]; | |
static unsigned char s[1]; | |
char mode = argc == 2 ? argv[1][0] : '\0'; | |
for(int i = 0; ; i++){ | |
switch(mode) { | |
case '0': | |
c[0] = s[i]; | |
break; | |
case '1': | |
s[i] = '\0'; | |
break; | |
case '2': | |
s[0] = c[i]; | |
break; | |
default: | |
c[i] = '\0'; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment