C
x
29
1
2
3
4
5
int main(){
6
7
char line[BUFFER_SIZE];
8
int c = 0;
9
int i = 0;
10
printf("Enter name: ");
11
while ( i + 1 < BUFFER_SIZE && c != '\n'){
12
c = getchar();
13
if (c == EOF) break;
14
line[i] = c;
15
++i;
16
}
17
line[i] = '\0';
18
i = 0;
19
while (line[i] != '\0'){
20
if (line[i] == '\t')
21
line[i] = '*';
22
++i;
23
}
24
25
printf("Line is %s \n", line);
26
27
return 0;
28
}
29
$ gcc prog.c -Wall -Wextra -std=gnu11 -pedantic-errors
Stdin
hoge fuga 334 foo
Start
Enter name: Line is hoge*fuga*334*foo
0
Finish