質問するログイン新規登録

回答編集履歴

3

微修正

2015/06/07 12:24

投稿

frogman
frogman

スコア129

answer CHANGED
@@ -24,7 +24,7 @@
24
24
  printf("Type sentens:");
25
25
 
26
26
  //scanf("%s", str);
27
- fgets(str, 256, stdin);
27
+ fgets(str, sizeof(str), stdin);
28
28
  str[strlen(str) - 1] = '\0';
29
29
 
30
30
  puts(str);

2

微修正

2015/06/07 12:24

投稿

frogman
frogman

スコア129

answer CHANGED
@@ -1,6 +1,5 @@
1
1
  標準関数を使用しないのであれば、なかば、強引に。。。
2
2
  ```lang-<c>
3
-
4
3
  #include<stdio.h>
5
4
  #include <string.h>
6
5
 
@@ -25,7 +24,8 @@
25
24
  printf("Type sentens:");
26
25
 
27
26
  //scanf("%s", str);
27
+ fgets(str, 256, stdin);
28
- strcpy( str, "i am foolish" );
28
+ str[strlen(str) - 1] = '\0';
29
29
 
30
30
  puts(str);
31
31
 

1

微修正

2015/06/07 12:16

投稿

frogman
frogman

スコア129

answer CHANGED
@@ -1,7 +1,6 @@
1
1
  標準関数を使用しないのであれば、なかば、強引に。。。
2
2
  ```lang-<c>
3
- コード
3
+
4
- ```
5
4
  #include<stdio.h>
6
5
  #include <string.h>
7
6
 
@@ -31,4 +30,5 @@
31
30
  puts(str);
32
31
 
33
32
  Big_letter(str);
34
- }
33
+ }
34
+ ```