Last active
August 24, 2017 12:44
-
-
Save obelisk68/e7a9a2deee2d96f6670354d6d5aac0c4 to your computer and use it in GitHub Desktop.
関数内で宣言した配列変数をreturnしてはいけない
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
#include <stdio.h> | |
char *keyboard_linein() { | |
char buf[1000]; | |
fgets(buf, 1000, stdin); | |
printf("%s\n", buf); | |
return buf; | |
} | |
int main() { | |
char *s; | |
s = keyboard_linein(); | |
printf("%s\n", s); | |
return 0; | |
} | |
//絶対に実行してはいけません。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment