回答編集履歴
2
ソース差し替え
test
CHANGED
@@ -4,13 +4,11 @@
|
|
4
4
|
|
5
5
|
~/test/ctst >cat tst01.c
|
6
6
|
|
7
|
-
|
7
|
+
#include <stdio.h>
|
8
8
|
|
9
9
|
#include <stdlib.h>
|
10
10
|
|
11
|
-
|
11
|
+
#include <string.h>
|
12
|
-
|
13
|
-
void fill( char * ptr, size_t len, const char ch );
|
14
12
|
|
15
13
|
//
|
16
14
|
|
@@ -40,7 +38,7 @@
|
|
40
38
|
|
41
39
|
//
|
42
40
|
|
43
|
-
|
41
|
+
memset( buf, '*', len );
|
44
42
|
|
45
43
|
buf[len]= '\n' ; // 改行
|
46
44
|
|
@@ -52,7 +50,7 @@
|
|
52
50
|
|
53
51
|
//
|
54
52
|
|
55
|
-
|
53
|
+
memset( &buf[1], ' ', len-2 );// 両端を残して中を空白に置き換える
|
56
54
|
|
57
55
|
for( size_t i= 1; i < len-1; i++ ){
|
58
56
|
|
@@ -60,7 +58,9 @@
|
|
60
58
|
|
61
59
|
}
|
62
60
|
|
61
|
+
//
|
62
|
+
|
63
|
-
|
63
|
+
memset( buf, '*', len ); // 中の抜けた文字列を別に作ればこれはいらない
|
64
64
|
|
65
65
|
fputs( buf, stdout );
|
66
66
|
|
@@ -68,25 +68,7 @@
|
|
68
68
|
|
69
69
|
return 0;
|
70
70
|
|
71
|
-
}
|
71
|
+
}
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
/* ポインタの示す領域を指定された長さの文字で埋める
|
76
|
-
|
77
|
-
*/
|
78
|
-
|
79
|
-
void fill( char * ptr, size_t len, const char ch )
|
80
|
-
|
81
|
-
{
|
82
|
-
|
83
|
-
for( size_t i= 0; i < len; i++ ){
|
84
|
-
|
85
|
-
*ptr++= ch;
|
86
|
-
|
87
|
-
}
|
88
|
-
|
89
|
-
}
|
90
72
|
|
91
73
|
```
|
92
74
|
|
1
誤記修正
test
CHANGED
@@ -72,7 +72,7 @@
|
|
72
72
|
|
73
73
|
|
74
74
|
|
75
|
-
/* ポインタの示す領域
|
75
|
+
/* ポインタの示す領域を指定された長さの文字で埋める
|
76
76
|
|
77
77
|
*/
|
78
78
|
|