Professional Documents
Culture Documents
'a''b''$'
, ,
,
?
'C' "C"
3
'C' "C"
,
,
,
, ,
'\0' (ASCII 0) 'C' "C" ,
,
'C' "C"
'C' "C"
ch,
'C', ch=c;
ch=c;
,
,
'\0'
2 , 1
'\0', ;
2
'\0'
,
,
char []=;
10
1. char, ,
char
2.
3.
,
( +1),
4.
11
sizeof()
,
13
14
15
,
,
,
,
'\0', ,
char name[]= "John Smith;
char name[]={J,o,h,n,
,S,m,i,t,h,\0};
16
17
, printf ( ) %s
, '\0' ,
name2 ,
printf ( ) ,
"Mary White"
, ,
name1 name2 , printf ( )
name1 ,
name1 ,
18
,
,
, ,
,
, ,
,
,
19
20
10
,
C
(=)
char name[11]; .
name[]=John Smith; X
21
, C
strcpy()
,
strcpy(name,John Smith);
22
11
23
,
,
, ,
scanf()
gets()
24
12
scanf()
, scanf() %s
,
, ,
scanf()
,
25
scanf()
26
13
gets ( )
scanf()
, gets()
char *gets();
, gets()
gets(),
27
gets()
gets(),
,
,
,
28
14
gets()
29
pus()
puts()printf() puts()
int puts();
30
15
strlen()
, strlen() ,
32
16
, (=), A
B, B=A
, A
B strcpy()
strncpy()
strcpy()
strncpy()
33
strcpy()
strcpy()
char *strcpy(,);
* ,
,
,
3
34
17
strcpy()
1. ,
,
2. ,
,
3. ,
,
,
35
strcpy()
, ,
,
, 1 2
, 2 1
,
36
18
strcpy()
37
strcpy()
38
19
strncpy()
strncpy ( ) ,
char *strncpy(,,);
, 1
, strcpy()
,
, 1
, 2 ,
39
strncpy()
40
20
strncpy()
41
strncpy()
42
21
,
,
43
,
C
, str1 str2
,
strcmp()
strncmp()
44
22
strcmp()
strcmp()
int strcmp(1,2);
strcmp() ,
strcmp() ,
0,
, 0 ,
0,
0
45
strcmp()
strcmp() 3
, strcmp()
,
2 ,
strcmp(),
46
23
strcmp()
47
strcmp()
48
24
strncmp()
strncmp(), strncmp()
n ,
strcmp ( ) ,
int strncmp(1,2,);
strncmp() ,
,
49
strncmp()
50
25
strncmp()
51
strcat()
strncat()
52
26
strcat()
strcat ( ) ,
char *strcat(,);
,
,
,
,
,
53
strcat()
54
27
strcat()
55
strncat()
strncat(), n
, ,
char *strncat(,,);
strncat() ,
,
, "ballet" 4
"foot" ,
56
28
strncat()
57
strncat()
58
29
strtok()
strtok ( )
,,
char *strtok(,);
59
, ASCII
, "123",
123 ,
C ,
,
atoi()
itoa()
atof()
60
30
atoi()
atoi() ( 123)
,
int atoi();
,
(0~9) int ,
()
, 0
61
atoi()
4 , atoi()
atoi() ,
,
, 1911
62
31
atoi()
63
atoi()
64
32
itoa()
itoa() atoi() , itoa()
,
char *itoa(,,);
1.
2. ,
3.
65
itoa()
itoa() ,
,
, , ,
,
"",
66
33
itoa()
67
itoa()
16 itoa ( ) , age
, 10
str_age
68
34
atof()
atof() atoi() , atof()
. ,
double atof();
atof() , 1
'.',
69
atof()
4 , atof()
70
35
atof()
, ,
'e' 'E' , "11e2"
, ,
,
6 , 6 ,
71
atof()
72
36
atof()
73
atof()
74
37
, aa bb
aabb bbaa
(substring)
, aba
bab aabb , aabb
aabb
aabbabaababb
aabb
75
76
38
,
string.h strstr()
strstr(,);
strstr(),
, ,
NULL
77
printf ( ) %s
,
printf ( ) %s
strstr ( ) , ,
,
78
39
79
80
40
81
82
41
7 , 8
,
14 , strstr ( ),
str , target
0 ,
18 , ,
str
0 , 1
83
,
"my "
"This is money" is money ,
"This is my
money"
3
84
42
1.
2. ,
85
3.
3 ,
86
43
87
88
44
1. 7 str ,
,
8 ,
insertstr
2. 1617 ,
,
89
3. 19 str
,
,
4. 2223 ,
3 ,
,
90
45
1.
2. ,
91
92
46
93
1. 6
2. 7 position
, length
3. 8 i
,
94
47
4. 12
, 13
position ,
,
('\0'),
5. 15 position
length ,
,
95
, ,
,
96
48
, 1
,
97
98
49
printf() %s
, ,
,
99
100
50
1. 5 ,
, [4] ,
[20]
2. 11
12 printf ( ) str [i]
[i]
101
, ,
,
,
,
,
,
, "qq"
102
51
103
104
52
105
1. 14~19 , 17
, strcmp ( )
"qq""qq" ,
, 19
,
2. 22~27 ,
lline , lline
,
"qq", 1,
106
53
(palindrome)
107
108
54
109
1. 6 ,
2. 10 ,
,
3. 12 ,
, ASCII
65 ~ 90
110
55
1. 13 , ,
ASCII 32,
ASCII
2. 14~15 ,
, ASCII 32,
ASCII
111
strlen ( ) ,
printf ( ) ,
112
56
113
(palindrome)
, 1
2 2
...
, ,
, "a toyota"
,
, ,
114
57
(palindrome)
115
(palindrome)
116
58
(palindrome)
117
(palindrome)
1. 89 , 2 str [ ]
,
,
letter [ ]
2. 15~22
, isalpha ( ) ,
letter
118
59
(palindrome)
3. 29 ,
2
, ,
119
,
,
, ""
1 , "Monday"
1 ,
120
60
121
122
61
123
1. 8~23 , ,
strary1 ,
strary2 ,
Monday
Tuesday... Sunday
2. 31~40 , 29
, strary1 ,
, strary2 ,
124
62
,
,
()
,
125
126
63
127
128
64
1. 16~24 ,
, name
,
2. 28~36 ,
129
I am a good boystring
1. scanf(%s,string); printf(%s,string);
2. gets(string); printf(%s,string);
1. int str[]=a student;
2. char array[]=a student;
3. char c[10]=I am a student;
4. char str[10]=;
5. char str[4][15]=,
, ,;
130
65
131
66