3 ?
T |?
!y?
3 ?
T |?
!y?
3 ?
T
3 ?
T
C?y# 
?y# 
?
"d 7?
?
"d 7?
?
?
5?
?
2
2
1|?]
??a?Mo1 ó¥BF
1|?]
??a?Mo1 ó¥BF
F?B?μ?8
P¨
F?B?μ?8
P¨
C?y4B?
?y4B?
?1,2
2
Ӵ
2
¥
2
b
5.1 2 ??D2M
¥?l
2 ??D2M
¥?l
5.2 2M
¥?¨D
S
2M
¥?¨D
S
5.3 2
F
2
F
5.4 ·_2 ??
¥·?
·_2 ??
¥·?
5.5
¨?
?
¨?
?
5.1 2 ??D2M
¥?l
2 ??D2M
¥?l
C?y?¥2 ??M?? 
ú)?y?¥
?y?¥2 ??M?? 
ú)?y?¥
“:
c
:
c
” ?
?
?b
5.1 2 ???l
2 ???l
struct 2 ??

2 ??

/* struct
^2 ??1o3
^2 ??1o3
*/
{
??
??
[
[
1;
??
??
[
[
2;
…… ……
??
??
[S
[S;
}; /* N?s|?

N?s|?

*/
[? è 5.1] ?lB?Q?D
3' f ?¥2 ??¨[i%D
3¥?lB?Q?D
3' f ?¥2 ??¨[i%D
3¥
M1?bM1?b
/*?
?lB?Q?D
3' f ?¥2 ???
?lB?Q?D
3' f ?¥2 ?? */
struct date /* °
ù2 ???
Maa ° ?[F? °
ù2 ???
Maa ° ?[F? */
{int year;
int month;
int day;
};
struct std_info //D
3?2 ???D|a?
a?Y
3 °F?D
3?2 ???D|a?
a?Y
3 °F?
{char no[7];
char name[9];
char sex[3];
struct date birthday;
};
struct score /*?2 ???D| ?
ê?
?2 ???D| ?
ê?
4[F?[F? */
{char no[7];
int score1;
int score2;
int score3;
};


1

“2 ??

2 ??




[
[
Ӵ

5DM


¥

5DM


M]b


2
??M]¥
[; V??a??sY

??M]¥
[; V??a??sY
?l9 Vi?B??lb
è ?'? è}
?¥ °
ù2 ?? 9 V?1 ?/
è ?'? è}
?¥ °
ù2 ?? 9 V?1 ?/
?
T
?
T
struct date
{int year,month,day;
};


3

2 ???¥
[; V[
^'
?
2 ???¥
[; V[
^'
?
?9
?
^
6B?Xü?l¥2 ??b
?9
?
^
6B?Xü?l¥2 ??b
è ?'? è}
?¥2 ?? std_info 
[

[
“birthday”ü
^B?Xü?l¥ °
ù2 ??

^B?Xü?l¥ °
ù2 ??
dateb
5.2 2M
?l
2M
?l
¨ 1 -?l¥2 ??D"d?l¥S ??
¨ 1 -?l¥2 ??D"d?l¥S ??


intachar?B" V¨ ??l2M
¥ ??b
?B" V¨ ??l2M
¥ ??b
1.?l2M
¥ZE Và ?1
?
?l2M
¥ZE Và ?1
?


1

W¤?lE aa
aa
5?l2 ??a?l2
M

M

è ? ?¨ [? è 5.1]??l¥D
3?2 ??
std_info ?l
B?M?¥2M

?l
B?M?¥2M

student

struct std_info student;
2M

2M

student

?μ2 ??¥ ???? ?
?μ2 ??¥ ???? ?
birthday??
^B? °
ù2 ??
??
??
^B? °
ù2 ??
??
3????b
????b
?i 
P¨W¤?lE?l2M

HA?]
H

P¨W¤?lE?l2M

HA?]
H
·?2 ??
b


2 °¤?lE aaaa ?l2 ??¥]
H?l2M
?l2 ??¥]
H?l2M

è ?2M
 è ?2M
 student¥?l V[?1 ?/?
T¥?l V[?1 ?/?
T
struct std_info
{……
} student;
]
H?l2 ??# 2M
¥B?ì
T ?/]
H?l2 ??# 2M
¥B?ì
T ?/
struct [2 ??
2 ??
]
{ ……
} 2M
V 2M
V
2.
a
ü
a
ü


12 ??D2M

^
??]¥à
Q  uY ?]2 ??D2M

^
??]¥à
Q  uY ?] int ? ?
?D?D int?M
¥ uYB"b?M
¥ uYB"b


2 2 ???¥??
 V[D???¥M
]

ì} 2 ???¥??
 V[D???¥M
]

ì}
V?]¥`o?? ?b
5.2 2M
¥?¨D
S
2M
¥?¨D
S
[? è 5.2] ?¨ [? è 5.1]??l¥2 ??
??l¥2 ??
struct std_info
?lB?2M

?lB?2M

student ¨?i% A
U B ? D
3 ¥ 
¨?i% A
U B ? D
3 ¥ 
' f ?b
#include"stdio.h"
/*?li
SB???2M

?li
SB???2M

student */
struct std_info student={"000102","f ? ","
3
3
",{1980,9,20}};
main()
{ printf("No,%s\n",student.no);
printf("Name,%s\n",student.name);
printf("Sex,%s\n",student.sex);
printf("Birthday,%d-%d-%d\n",student.birthday.year,
student.birthday.month,student.birthday.day);
}
?????? 

17
???2T
???2T
No,000102
Name,f ?
Sex,
3
3
Birthday:1980-9-20
1.2M
¥?¨5
2M
¥?¨5
?2M
1YV??
?
?2M
1YV??
?
“.”??`ù ?
??`ù ?
? O`ù¥ì
T1
? O`ù¥ì
T1
2M

2M

.??
??
/* ?¥
?¥
“.”
^??
?
^??
?
*/
è ?? è?¥ student.no ?¨2M

?¨2M

student?¥
no??
??
student.name?¨2M

?¨2M

student?¥ name?
?
???b
?T
??'
&?
^B?2 ??5o
YV)
?T
??'
&?
^B?2 ??5o
YV)
¥s

K?B)¥??é??¨b
¥s

K?B)¥??é??¨b
N
H¥?¨ì
T ?Z1
N
H¥?¨ì
T ?Z1
2M

2M

.??
??
.0??
0??
.….K?
K?
1)0??
)0??
è ??¨2M
 student?¥ birthday??¥ì
T
??¥ì
T
sY1
student.birthday.year
student.birthday.month
student.birthday.day


1

K?B)?? V^] ??¥
YM
B
K?B)?? V^] ??¥
YM
B
"é?M?¥ò?
b
"é?M?¥ò?
b


2; V?¨2M
??¥1? 9 V? ¨2
; V?¨2M
??¥1? V? ¨2
M
¥1?b
è ? &student.name  &student b
2.2M
¥
S
2M
¥
S
2M

S¥ì
TDB?
FM

2M

S¥ì
TDB?
FM

2M

2M

={′V }
?]¥
^ ?T
??'
&?
^2 ??5
?]¥
^ ?T
??'
&?
^2 ??5
???¥′1B?′Vb
è ? [? è 5.2]?¥ student={"000102","f ? ",
"
3
3
",{1980,9,20}}b
?i ′¥
???D2M
?M?
′¥
???D2M
?M?
??
1 p¥Bá?5pb
??
1 p¥Bá?5pb
5.3 2
F
2
F
2
F¥
B?í
í?
^2 ??
 (c2
2
F¥
B?í
í?
^2 ??
 (c2
??¥
μ??b
??¥
μ??b
[? è 5.3] ?¨ [? è 5.1]??l¥2 ??
??l¥2 ??
struct std_info
?lB?2
F
?lB?2
F
student ¨?i%A
U ??D
3¥' f
¨?i%A
U ??D
3¥' f
?
?
#include"struct.h"
/*?li
SB???2
F
?li
SB???2
F
student[3] */
struct std_info student[3]={{“000102”,“f ?,,“
3
3
”,{1980,9,20}},
{“000105”,“ ù
1,,“
3
3
”,{1980,8,15}},
{“000112”,“|?
|?
”,“
o
o
”,{1980,3,10}} };
/*?f
?f
main()*/
main()
{ int i;
/*u?Vh," ′"V
U
V
U
1? bì3?
? bì3?
*/
printf("No.′′′′Name′′′′′Sex′Birthday\n");
/*
{ ??D
3¥' f ?
{ ??D
3¥' f ?
*/
for(i=0; i<3; i++)
{ printf("%-7s",student[i].no);
printf("%-9s",student[i].name);
printf("%-4s",student[i].sex);
printf("%d-%d-%d\n",student[i].birthday.year,
student[i].birthday.month,student[i].birthday.day);
}
}
???2T
???2T
No,Name Sex Birthday
000102 f ?
3
3
1980-9-20
000105 ù
1
3
3
1980-8-15
000112 |?
|?
o
o
1980-3-10
D2M
¥?lM
2
F¥?l9s
D2M
¥?lM
2
F¥?l9s
°¤?lW¤?l
?ZEo3
a
ü1
F
' Vb
D
Y
FB"2
F 9 V?l
Hé?
D
Y
FB"2
F 9 V?l
Hé?

Sb
S¥ì
T1

Sb
S¥ì
T1
2
F
2
F
[n]"
"
{{′V 1} {′V 2},.. {

′V n}}
è ?'? è?¥2
F student[3]b
5.4 ·_2 ??
¥·?
·_2 ??
¥·?
2M

=i?¥ 
S1??12M
¥·?b
2M

=i?¥ 
S1??12M
¥·?b
5.4.1 ·_2M
¥·?
·_2M
¥·?
[? è 5.4]
P¨·_2M
¥·? ?`ù2M
¥ò?
P¨·_2M
¥·? ?`ù2M
¥ò?
??b
#include“struct.h”
struct std_info student={“000102”,“f ?,,“
3
3
”,{1980,9,20}};
main()
{ struct std_info *p_std=&student;
printf("No,%s\n",p_std->no);
printf("Name,%s\n",p_std->name);
printf("Sex,%s\n",p_std->sex);
printf("Birthday,%d-%d-%d\n",p_std->birthday.year,
p_std->birthday.month,p_std->birthday.day);
}
YV·_2M
¥·? ?`ù2M
¥??D
YV·_2M
¥·? ?`ù2M
¥??D
°¤
P¨2M
¥rTB "b B? 1
a  ?T· ?M
°¤
P¨2M
¥rTB B?


pointerX·_2M

X·_2M

var 5[/ ???
T?N
5[/ ???
T?N


1

var.??
??


2

pointer->??
??


3

(*pointer).??
?? /*,*pointer”?
¥ ?|?
8?
¥ ?|?
8 */
?i ì
T
1?s

?P§¥

`o
^2M
 7ì
T
`o
^2M
 7ì
T
2?·_
?
P§¥
`o
^· _2M

2
F
_2M

2
F
¥·?M
?5?pb
± I5
± I5
 ?T1 pVo

{ ?2M

 ?T1 pVo

{ ?2M

student¥ò
¥ò
??
 ?????$
??
 ?????$
5.4.2 ·_2
F¥·?
·_2
F¥·?
[? è 5.5]
P¨·_2
F¥·? ?`ù2
Fb
P¨·_2
F¥·? ?`ù2
Fb
#include"struct.h"
/*?li
SB???2
F
?li
SB???2
F
student */
struct std_info student[3]={{"000102","f ? ","
3
3
",{1980,5,20}},
{"000105"," ù
1 ","
3
3
",{1980,8,15}},
{“000112”,“|?
|?
”,“
o
o
”,{1980,3,10}} };
main()
{ struct std_info *p_std=student;
int i=0;
/*u?Vh */
printf("No.′′′′Name′′′′′Sex′Birthday\n");
/*
{2
F
= ?
{2
F
= ?
*/
for( ; i<3; i++,p_std++)
{ printf("%-7s%-9s%-4s",p_std->no,p_std->name,p_std->sex);
printf("%4d-%2d-%2d\n",p_std->birthday.year,
p_std->birthday.month,p_std->birthday.day);
}
}
?T·?M

?T·?M

pX·_
2
F5
X·_
2
F5
p+1· _ 2
F¥/
_ 2
F¥/
B?í
í7?
^? -í
í¥/B???b
B?í
í7?
^? -í
í¥/B???b
6? ?T· ?M


pXü·_B?2M

2
Xü·_B?2M

2
Fü?

P-·_2M

2
F í
í  ¥
 B ?
Fü?

P-·_2M

2
F í
í  ¥
 B ?
?b
5.4.3 ·_2
¥·?Tf
?
·_2
¥·?Tf
?
[? è 5.6] ¨f
?¨Z
T?
¨f
?¨Z
T?
[? è 4.5]IB?
ê¥
IB?
ê¥
A
Uf
A
Uf
display() YV?f
?¨ ?
LCA
Ub
YV?f
?¨ ?
LCA
Ub
#include"struct.h"
/*?li
SB???2
F
?li
SB???2
F
student */
struct std_info student[3]={{"000102","f ? ","
3
3
",{1980,5,20}},
{"000105"," ù
1 ","
3
3
",{1980,8,15}},
{“000112”,“|?
|?
”,“
o
o
”,{1980,3,10}} };
/*?f
?f
main()*/
main()
{ void display(); /*f
a
ü
f
a
ü
*/
int i=0;
/*u?Vh */
printf("No.′′′′Name′′′′′Sex′Birthday\n");
/*u?
= ? */
for( ; i<3; i++)
{ display( student + i );
printf("\n");
}
}
void display(struct std_info *p_std)
{ printf("%-7s%-9s%-4s",p_std->no,
p_std->name,p_std->sex);
printf("%4d-%2d-%2d\n",p_std->birthday.year,
p_std->birthday.month,p_std->birthday.day);
}
5.5
¨?
?eo
¨?
?eo
5.5.1
¨?
¨?
1à
Q
à
Q
P+??]¥M
]¨]B
=i bW¥2?1
P+??]¥M
]¨]B
=i bW¥2?1
¨?b
2
¨ ??¥?l

¨ ??¥?l
aa
aa
D2 ??¥?l ?
D2 ??¥?l ?
union
¨ ??

¨ ??

{??
V
??
V;};
3
¨M
¥?l
¨M
¥?l
aa
aa
D2M
¥?l ?
D2M
¥?l ?


1W¤?l
W¤?l
aa
aa
5?l ??a?lM

è ??l data
¨ ??M

¨ ??M

un1,un2,un3¥?  ?/
¥?  ?/
union data un1,un2,un3



2

°¤?l aa
aa
?l ??¥]
H?lM

?l ??¥]
H?lM

è ? union [data]
{ int i;
char ch;
float f;
} un1,un2,un3;
¨M
]¨¥
=i bW??Ké??¥é
¨M
]¨¥
=i bW??Ké??¥é
7?
^ò??é-b
7?
^ò??é-b
è ?
¨M
 un1aun2

un3  16ê?T"d
ê?T"d
?]¨¥
=i bW (13?
?
^ 2+1+4=73?b

¨M
¥?¨

¨M
¥?¨
aa
aa
D2M
B"9o
D2M
B"9o
???¨
¨M
¥??
???¨
¨M
¥??
è ?`ù
¨M
 un1ò??¥ì
T1
ò??¥ì
T1
un1.ia
un1.chaun1.fb
5+?
+?


1"d?¨-?/

LC
¨M
ò??¥
=i
"d?¨-?/

LC
¨M
ò??¥
=i
Z
[
B
H Yib¥ T¨¥
^KaBQi ?¥?
Z
[
B
H Yib¥ T¨¥
^KaBQi ?¥?
?′b
è ?3? un1.i=1,un1.ch='c',un1.f=3.14a un1.f?
^μ
?
^μ
r¥??b
r¥??b


2??
μ??
Z]B
=i bW#
¨M
D 
??
μ??
Z]B
=i bW#
¨M
D 
ò??¥1?M]b
è ?
un1"
"
un1.i"
"
un1.ch"
"
un1.fb


3

?

¨M
é? 
S
?i2M
 V
?

¨M
é? 
S
?i2M
 V
[ 9?
|
¨M
T1f
?
[#
Pf
RíB?
[ 9?
|
¨M
T1f
?
[#
Pf
RíB?

? V[
P¨·_
¨M
¥·?b

? V[
P¨·_
¨M
¥·?b


4
¨ ?? V[C2 ???l?Q-g ?b

¨ ?? V[C2 ???l?Q-g ?b
5.5.2
?
?
1
 ??¥?l

 ??¥?l
enum
 ??

 ??

{ |′V }

è ? enum weekdays {Sun,Mon,Tue,Wed,Thu,Fri,Sat}


M
¥?l
M
¥?l
aa
aa
D2M
 ?
D2M
 ?


1W¤?l
W¤?l
è ? enum weekdays workday;


2

°¤?l
è ? enum [weekdays]
{Sun,Mon,Tue,Wed,Thu,Fri,Sat } workday;

a
ü
a
ü


1
??
a?? |′μK¥
b

??
a?? |′μK¥
b
è ?? C?¥ ?E???
M?b


2 |′V?¥′?1
í
í cl???3
db
è ??
^y1?,Sunӟ1?}V
ü1?}V
“?
ù?
?
ù?
”b
Y
L

í
í¨
I
1V
U? V[b
í
í¨
I
1V
U? V[b


3

í
íT1è

^μ′¥
í
íT1è

^μ′¥
aa
aa
?l
H
¥
¨?|
V 7
S
[
í
í V[é?
¥
¨?|
V 7
S
[
í
í V[é?
1?1?5
^?|v?1v
è ?
 è?¥ Sun=0aMon=1a……a
Sat=6
[
[
Mon>SunaSatKvb


4
í
í¥′9
^ V[ |1?M¥ 

í
í¥′9
^ V[ |1?M¥
?l
H???·?b
è ? ?T enum weekdays {Sun=

,Mon"
"


,Tue,Wed,Thu,Fri,Sat} 5 Sun= Mon=
V
V
Tue=2 7
SGQ9b
?lXμ ??¥Y

?lXμ ??¥Y

" V°¤
P¨(4¥S ??1?l¥ ??
2
" V°¤
P¨(4¥S ??1?l¥ ??
2
a
¨a
?9 V
P¨
a
¨a
?9 V
P¨
typedef?lXμ ??¥Y
?lXμ ??¥Y
b?Y
DS ??
B" V¨ ??lM?¥M
b
b?Y
DS ??
B" V¨ ??lM?¥M
b
?lXμ ??Y
¥ZE ?/
?lXμ ??Y
¥ZE ?/


1??lM
¥ZE?l8
??lM
¥ZE?l8


2|M

D?Y

|M

D?Y



3?l8K -
F

?l8K -
F

typedefb
[? è ] ó
L?

L?
float?l 1?Y

?Y

REALb


1

??l
L?M
¥ZE?l8
??l
L?M
¥ZE?l8
float f;


2

|M

D?Y

|M

D?Y

float REAL;


3

?l8K -
F

?l8K -
F

typedef

typedef float REAL;
[? è ] ó ?/
U¥2 ??ó ?/
U¥2 ?? struct date?l 1?Y
?Y
DATEb
struct date
{ int year,month,day;
};


1 ??l2M
¥ZE?l8??l2M
¥ZE?l8 struct date {……} d;


2 |M

D?Y
|M

D?Y
 struct date {……} DATE;


3 ?l8K -
F
?l8K -
F
 typedef typedef struct date {……} DATE;
a
ü
a
ü




1¨
¨
typedefo
^ óX μ ? ?9F?Y
i?
7/
óX μ ? ?9F?Y
i?
7/
??¥ ??bü ?] |B""D
? V[ |B?l


??¥ ??bü ?] |B""D
? V[ |B?l


?|?i?
7/
6B? | ?b
?|?i?
7/
6B? | ?b


2

typedefD
D
#defineμM
-)?=?
^?]¥ -?
^
μM
-)?=?
^?]¥ -?
^
?Ir Ir
H) ?¥a?
^ ?Ir?) ? Ir?) ?
?Ir Ir
H) ?¥a?
^ ?Ir?) ? Ir?) ?
H) ?¥7 Oo
Te?¥3?19Db
H) ?¥7 Oo
Te?¥3?19Db
yV) ?
yV) ?
aa
aa
2·?¥?¨
2·?¥?¨


1 yV2
 yV2
yVT1B?訥a

LC?
i%s
¥¥

yVT1B?訥a

LC?
i%s
¥¥

2 u
2
2
v [??μW%o
b1ZL
àμD
V
2¥?'
V?¨? yVTBe?o
V
2¥?'
V?¨? yVTBe?o
b


1

h·?M

h·?M

headaa
aa
·_ yV¥
n2?b
·_ yV¥
n2?b


2
?2??

?2??
2?×F?
?×F?
1



aa
aa
i%2?'
&¥?b
i%2?'
&¥?b
2·?× aa
aa
·_a?2?¥·?b


3á2?¥·?×?1,NULL

b,T1 yV2
¥S?b
2 yV¥'?T
 yV¥'?T
 yV¥'?Tμ7ya_
ì
°sa? ? a
 yV¥'?Tμ7ya_
ì
°sa? ?
÷"???b
÷"???b


17y yV
^·Ví?μ1y ? B? yV
7y yV
^·Ví?μ1y ? B? yV
'a b yV?GQ? ? ?? 2? i  ? 2? -W ¥ -
'a b yV?GQ? ? ?? 2?  ? 2? ¥ -
za?1"b
za?1"b


2_
ì?T
^·?ó?¥2?
ì?|_
ìH
_
ì?T
^·?ó?¥2?
ì?|_
ìH
q°s
?2?b ?Ts?·?¥2?5?1_
ì
?? ?5?1_
ì
>?b


3? ??T
^·2?
? ??T
^·2?
k
i-1
D
D
k
i
-W? ?B??¥
-W? ?B??¥
2?
2?
k’
PL?V¥é9
PL?V¥é9
1 O k
i-1
D
D
k
i
¥
1"?
3
¥
1"?
3
?/M
?/M
? ? -
? ? -
k
i-1
^
^
k
i
¥ - z
¥ - z
k
i
^
^
k
i-1
¥a? ? ?a?
¥a? ? ?a?
? ?¥2?
? ?¥2?
k’?1 k
i-1
¥a?a k
i
¥ - z ?m
¥ - z ?m
10-2
Ub


4 ÷"?T
^· ÷"2?
 ÷"?T
^· ÷"2?
k
i

PL?V¥éh
PL?V¥éh
1 O k
i-1
ak
i


k
i+1
-W¥
1"?
3 ?/M
-W¥
1"?
3 ?/M
÷" -
÷" -
k
i
^
^
k
i+1
¥ - za k
i-1
¥a? ÷"a
¥a? ÷"a
k
i-1
?
?
1k
i+1
¥ - z
¥ - z
k
i+1
?1 k
i-1
¥a? ?m
¥a? ?m
10-3
Ub
3(?y yV2?¥2
í
(?y yV2?¥2
í
(?y?¨2 ?? ?
í
2?2b è ?
(?y?¨2 ?? ?
í
2?2b è ?
struct grade
{ char no[7]; /*D|D| */
int score; /*?? */
struct grade *next; /*·?× */
};
7yB?? yV
7yB?? yV
[? è ] IB?IB? create()f
?v?¥2?27yB?f
?v?¥2?27yB?
? yV
yV?¥2??
?Kb? yV
yV?¥2??
?Kb
'
±
^
'
±
^


n5_"d
# hB?2?¥ bW ?a
{ ?2?

n5_"d
# hB?2?¥ bW ?a
{ ?2?

×¥
×¥
2?
[i|·?×?1 b
yáS?
Ka|?2?? ?? yVá b ? y V¥ ?B ?2 ?
Ka|?2?? ?? yVá ? y V¥ ?B ?2
1
!?h·?M
b
6?? è}
?¥ 3?·?M
 headanew

tail¥
¥
a
ü ?/
a
ü ?/


1

headaa
aa
h·?M
·_ yV¥?B?2
?¨Tf
Rí′b


2

newaa
aa
·_?
# h¥2?b
·_?
# h¥2?b


3

tailaa
aa
·_ yV¥á2?¨
·_ yV¥á2?¨
tail->next=new
LC|?
# h¥2?? ? ? y Vá 
P -? 1? ¥á
LC|?
# h¥2?? ? ? y Vá ¥á
2?b
/*? è}
óq

? è}
óq

*/
#define NULL 0
#define LEN sizeof(struct grade) /*?l2?é?l2?é*/
/*?l2?2?l2?2 */
struct grade
{ char no[7]; /*D|D| */
int score; /*?? */
struct grade *next; /*·?× */
};
/*create()f
f
,7yB? μh2?¥? yV7yB? μh2?¥? yV */
/*??í??í */
/*Rí′Rí? yV¥h·?Rí′Rí? yV¥h·? */
struct grade *create( void )
{ struct grade *head=NULL,*new,*tail;
int count=0; /* yV?¥2??
yV?¥2??
(′1 0)*/
for( ; ; ) /* ?
8 ?
8 3?Vr
T¥?Vr
T¥ for?  */
{ new=(struct grade *)malloc(LEN); /*
# hB??2?¥ bW
# hB??2?¥ bW */
/*1a
{ ?2?
×¥ò
[
{ ?2?
×¥ò
[ */
printf("Input the number of student No.%d(6 bytes),",count+1);
scanf("%6s",new->no);
if(strcmp(new->no,"000000")==0) /* ?TD|1 ?TD|1 6?? 05| */
{ free(new); /*
dbKa
# h¥2? bW
dbKa
# h¥2? bW */
break; /*2
2
for?  */
}
printf("Input the score of the student No.%d,",count+1);
scanf("%d",&new->score);
count++; /*2??
F2??
F 1*/
/*2a??2?¥·?×1 b */
new->next=NULL;
/*3a|?2?? ?? yVái
!??¥á·?|?2?? ?? yVái
!??¥á·? */
/*
^?B?2?
^?B?2?
,?h·? */
if(count==1) head=new;
/*d
n2?
d
n2?
,|?2?? ?? yVá
|?2?? ?? yVá
*/
else tail->next=new;
tail=new; /*
!??¥á2?
!??¥á2?
*/
}
return(head);
} [??
U
??
U
]
± I5
± I5
 
!9i%D|
¥3?
F
H 
 
!9i%D|
¥3?
F
H 

í?
?1D|é

í?
?1D|é
+1b1
I
1$
 yV¥? ??T
 yV¥? ??T
[? è ] IB?
IB?
insert()f
???
f
???
yV¥ ?
yV¥ ?
i?2?a? ?
?2?a? ?
1??2?¥?Tb
??2?¥?Tb
?
?
i=0
HV
U?2?? ???B?2?-
HV
U?2?? ???B?2?-
-?1 yV?¥
n2?b
-?1 yV?¥
n2?b
'
±
^
'
±
^


YV? yV¥h·?
n5s? yV¥?B?2 ? 
YV? yV¥h·?
n5s? yV¥?B?2 ? 
?a
¨"2?¥·? × s ? ?
?a
¨"2?¥·? × ? ?
i?2?Ka|?2??
?2?Ka|?2??
???
???
i?2?-ab
/*? è}
óq

? è}
óq

*/
/*f
?
? yV¥?
f
?
? yV¥?
i?2?a? ?
?2?a? ?
1?? 2 ?
?? 2 ?
*/
/*f
?

f
?

head1? yV¥h·? new·_1?
·_1?
?¥?2?
?¥?2?
i12?
ì?|
12?
ì?|
*/
/*f
Rí′? yV¥h·?
f
Rí′? yV¥h·?
*/
struct grade *insert(struct grade *head,struct grade *new,
int i)
{ struct grade *pointer;
/*|?2?? ?? yV?
|?2?? ?? yV?
*/
if(head==NULL) head=new,new->next=NULL; /*|?2?? ?
|?2?? ?
?
?
1? b yV? */
else /*d b yV */
if(i==0) new->next=head,head=new; /*
P?2??1
P?2??1
yV
yV
?¥
n2?
?¥
n2?
*/
else /* 
eê?

eê?
*/
{ pointer=head;
/*°s? yV¥?
°s? yV¥?
i?2?
?2?
(pointer·_
·_
)*/
for(; pointer!=NULL && i>1; pointer=pointer->next,i--) ;
if(pointer==NULL) /*?p
?p
*/
printf("Out of the range,can’t insert new node!\n");
else /*B? f ?
B? f ?
pointer·_?
·_?
i?2?
?2?
*/
new->next=pointer->next,pointer->next=new;
}
return(head);
} [??
U
??
U
]
(?
= ?
?
= ?
) ê
ê
1
?
8
=i bW"d èq?è|?
1
?
8
=i bW"d èq?è|?
S?
e?1FB i%?B?3?
S?
e?1FB i%?B?3?

3?b(?y
^1ù?"d èq7
!9

3?b(?y
^1ù?"d èq7
!9
¥
[
ò4

LC|S?
VS?3??
¥
[
ò4

LC|S?
VS?3??
s ? ?¥ê
?
b
s ? ?¥ê
?
b
ìê
^·?=é?êé?¥
b
ìê
^·?=é?êé?¥
b
1
′9
?¥V
U
′9
?¥V
U
2 ê
ê
3 ê
ê
1
′9
?¥V
U
1.=é?êD3?
=é?êD3?
9
"d¥
=i% 
^???13?¥?íF
9
"d¥
=i% 
^???13?¥?íF
?¥
?¥
1?3??
?3??
8?=é?ê
?=é?ê
bit

?
ê¥ |′1
0/1bK·
¥
*
bK·
¥
*
1ê?1,K?ê
K?ê
”I|1 0 KP
¥
*
 KP
¥
*
1
ê?1,Kúê
Kúê
”7 OVK?ê?Kúê
¨?GQI|b
7 OVK?ê?Kúê
¨?GQI|b
m
m
11-1
^
^
1?3?ò=é?ê¥I|b
?3?ò=é?ê¥I|b
m
m
11-1 1?3?ò=é?ê¥I|
?3?ò=é?ê¥I|
2.
′¥e
V
U
′¥e
V
U
′¥e
V
U
^·|Kúê¨T?|ê
′¥e
V
U
^·|Kúê¨T?|ê
0V
U?
V
U?
 1V
Uμ
 ?òê}V
′'
&¥ '′
[=
V
Uμ
 ?òê}V
′'
&¥ '′
[=
é??
TV
U¥V
U?
Tb1e
í
n'???
é??
TV
U¥V
U?
Tb1e
í
n'???


1?3?V
U
?3?V
U
1??
??
b
7 6 5 4 3 2 1 0
è ? +9¥e
^
¥e
^
00001001
?1 ?|ê
¥
?|ê
¥
0V
U?
V
U?
-9¥e
^
¥e
^
10001001b
?1 ?|ê
¥
?|ê
¥
1V
Uμ
V
Uμ
3.
′¥Q
V
U
′¥Q
V
U
′¥Q
V
Us
? f ?
′¥Q
V
Us
? f ?


1?
¥Q
De
M]b
?
¥Q
De
M]b
è ? +9¥Q
^
¥Q
^
00001001b


2μ
¥Q
?|ê1
μ
¥Q
?|ê1
1 ?òê1 ?
'
?
'
′¥e
?ê |Q
′¥e
?ê |Q
1M
M
0a0M
M
1b
è ? -9¥Q
y1
^μ
5?|ê1,1” 
 
?
?
7ê1 -9¥ '′ +9¥e
0001001?ê |Q1
1110110
[

[
-9¥Q
^
¥Q
^
11110110b
4.
′¥?
V
U
′¥?
V
U
′¥?
V
U9s
? f ?
′¥?
V
U9s
? f ?


1?
¥?
De
M]b
?
¥?
De
M]b
è ? +9¥?
^
¥?
^
00001001b


2μ
¥?
?|ê1
μ
¥?
?|ê1
1  ?ê1?
'′
¥e
?ê |Q ?a??
F
¥e
?ê |Q ?a??
F
1b
è ? -9¥?
y1
^μ
5?|ê1
¥?
y1
^μ
5?|ê1
“1” ?
 ?
7
ê1 -9¥ '′ +9¥e
¥e
0001001?ê |Q1 1110110 
F
F
1
[

[
-9¥?
^
¥?
^
11110111b
X?B?
¥?
 pe
¥?Ts
? f ?
X?B?
¥?
 pe
¥?Ts
? f ?


1 ?T?
¥?|ê1
 ?T?
¥?|ê1
“0”V
U
^B??

V
U
^B??

[?

^?
¥e
b
[?

^?
¥e
b


2 ?T?
¥?|ê1
 ?T?
¥?|ê1
“1”V
U
^B?μ
 p
V
U
^B?μ
 p
e
¥? T V[
^?|ê?M ?òê |Q ?a
e
¥? T V[
^?|ê?M ?òê |Q ?a
??
F
??
F
1b
è ?X?B??
1 111110015e
^
10000111

-7y1 ?| ê1
?|
“1”V
U
^B?
V
U
^B?


[?ê?M ˉ1


[?ê?M ˉ1
“1” ?
 ?
7ê

1111001
|Qa1 0000110 F
 F
1
[
^

[
^
10000111b
5.
′9
?¥V
U
′9
?¥V
U
aa
aa
?
?
9
"d?
′B
p¨?
V
U
i
i
%ey?
P¨?
 V[|?|ê 
%ey?
P¨?
 V[|?|ê 
êdB) ? ]
HhE9 V?FE ?) ?b
êdB) ? ]
HhE9 V?FE ?) ?b
6?
?¨?
V
U¥
MF
H ?TKúê
6?
?¨?
V
U¥
MF
H ?TKúê

?|êμéê5éê$
 b

?|êμéê5éê$
 b
2 ê


ê
# 
?
ê
# 
?
1?êD?êD aaaa &
(1)ì
Tì
T x&y
(2)5?ê (1 1
H?1 1?51 0 3&9=1b
è ? 3&9=1 0011
& 1001
aaaaaaaa
0001=1
(3)?1¨o |?1¨o | (
=
= )1?
¥
?
¥
 (tt )ê ?òê?ê ?òê? 0b
2?ê?êaaaa |
(1)ì
Tì
T x|y
(2)5?ê (1 0
H?1 0?51 1 3|9=11b
è ? 3|9=11 0011
| 1001
aaaaaaaa
1011=11
(3)?1¨o|?1¨o| 1?
¥
?
¥
 (tt )ê? 1 ?òê?Mb ?òê?Mb
3 ?ês
?ês
aa
aa
^
(1)ì
T

T
x^y
(2)5?êM]
H1
5?êM]
H1
0?]
H1 1

3^9=10b
(3)?1¨o
P
?1¨o
P
1?
¥

?
¥

(t
t
)êJ
êJ
('e ?1
'e
1¥ê
¥ê
M1 01 0¥M1 1) ?òê?Mb
 ?òê?Mb
4?ê |Q
?ê |Q
aa
aa
~
(1)ì
T

T
~x
(2)5 ò ê J 'e ?1
5 ò ê J 
1¥êM?
¥êM?
0e ?1 0¥
¥
êM?
êM?
1 IBM-PC? ~0"
"
0xffff ~9=0xfff6b
(3)?1¨oW¤1/B?
[9 <??¥ VM
?1¨oW¤1/B?
[9 <??¥ VM
±?b
5?êPM
?êPM
aa
aa
<<
(1)ì
T

T
x<< ê

(2)5
P?T
¥òêPM?ê?
5
P?T
¥òêPM?ê?
0úên
úên
5<<2=20b
6?ê·M
?ê·M
aa
aa
>>
(1)ì
T

T
x>>ê

(2)5
P?T
¥òê·MM ¥ ? ê
  
5
P?T
¥òê·MM ¥ ? ê
  
úê
úê
1)í?|
μ?|?¥?
?
í?|
μ?|?¥?
?
0

2)μ?|
?¥μ
 | %?
P¨¥"d?
μ?|
?¥μ
 | %?
P¨¥"d?
0¥
¥
?1,
 ·M
 ·M
”? 1¥?1,
·M
·M
”b è ? 20 >>
2=5b
a
ü
a
ü




1

xay

“ê

”??T
?o
^??3?
3?
?
b"?ê |Q1?
" 
??   ? ( 1
"
?? ? (
?b


2?D
H?T
?D
H?T
x

y ?A?
n5D?
?A?
n5D?
=é??
T ?a3?M?¥?ê
b
=é??
T ?a3?M?¥?ê
b
è ? 5<<2=20

0101 1 10100 20 >> 2=5

10100
100101b


3
LC

LC
&a|a^
?1¨o¥ZE

?1¨o¥ZE
1/ 1??
?
1 |

=¥êa
??
?
1 |

=¥êa
1? 1¥êa1J¥ê
1
¥êa1J¥ê
1
1 ? (1 0b
2é??êDa?êa?ês?Tb
é??êDa?êa?ês?Tb


4
LC?ê |Q?1¨o¥ZE

LC?ê |Q?1¨o¥ZE
1 p
 p
~0W¤1/B? ?
W¤1/B? ?
1¥

¥

2?3 1é ?P M·M?T/
31¥
b
?3 1é ?P M·M?T/
31¥
b
è ?°¤/B? ? 1¥
 IBM-PC?1 0xffff


23?7
3?7
VAX-11/780
 ?
^
 ?
^
0xffffffff

43?b
?T¨
?T¨
~0 ?/"d V[1?
a?b
?/"d V[1?
a?b
?¨  è
?¨  è
[? è ] Vo

{ ?
Vo

{ ?
1???
ó intM

M

num
{
{
?
?
8j11ê?¥

V?êa
ê?¥

V?êa
0| 7
SI|b
| 7
SI|b
'
±
^
'
±
^




1
PM


PM

num·M
·M
8ê|
ê|
8j11êM??
êM??
4ê
b


2/
/
1??
??
4ê1 1a ?òê1 0¥?
b


3D
D
numé??êD
b
é??êD
b
/*? è}
óq

? è}
óq

*/
/*???

{B??
??
???

{B??
??
8j11ê?¥
ê?¥
*/
main()
{ int num,mask;
printf("Input a integer number,");
scanf("%d",&num);
num >>= 8; /*·M
·M
8ê|
ê|
8j11êM??
êM??
4ê



*/
mask = ~ ( ~0 << 4); /*W¤/
W¤/ 1???? 4ê1 1a ?òê1 0¥?
¥?
*/
printf("result=0x%x\n",num & mask);
} [??
U
??
U
]
??? f ?
??? f ?
Input a integer number:1000 oú
result=0x3
??
a
ü
??
a
ü


~ ( ~0 << 4)
?ê |
?ê |
0¥Q 1 ?
¥Q ?
1 PM
 PM
4êa ?
êa ?
4ê1 0 
?òê1 1 ?ê |Q5 ?
 ?ê |Q5 ?
4ê1 1 ?òê1 0b
???
?
^á
ì
31¥b
???
?
^á
ì
31¥b
[? è ] Vo

{ ?
Vo

{ ?
1???
ó intM

M

num ?=
?=
é?ê
{?
b
é?ê
{?
b
/*? è}
óq

? è}
óq

*/
/*???
?=é?ê
{B??
???
?=é?ê
{B??
*/
#include "stdio.h"
main()
{ int num,mask,i;
printf("Input a integer number,");
scanf("%d",&num);
mask = 1<<15; /*/ 1?Kúê1?Kúê1 1a ?òê1 0¥?
¥?
(
à73
à73 )*/
printf("%d=",num);
for(i=1; i<=16; i++)
{ putchar(num&mask? ’1’,‘0’); /*
{Kúê¥′
{Kúê¥′ (1/0)*/
num <<= 1; /*|QúêM?Kúê
|QúêM?Kúê
 */
if( i%4==0 ) putchar(‘,’); /*
1êBF¨ù|s 7
1êBF¨ù|s 7 */
}
printf("\bB\n");
} [??
U??
U ]
??? f ?
??? f ?
Input a integer number:1000 oú
1000=0000,0011,1110,1000B
a
ü
a
ü
1.ˉ?′
?
"?ê |Q
?   ?
"?ê |Q
? ?
5?ê
? ( VD?′
?B ?ˉ?′
? &=a|+a^=a<<=a
>>=
2.?]é
W¥ê
?]é
W¥ê
aa
aa
?3?

¥ú
?3?

¥ú
3??Kúê?ê
3??Kúê?ê


1í?|
μ?|?¥?
?
í?|
μ?|?¥?
?
0



2μ?|
?¥μ
?
μ?|
?¥μ
?
1b
3 ê
eo

Hi%μ
Hi% 1???A]¨???A]¨ 1?3?o3=é?¥ 1?
 ??
 ?
êü¨b ?T ˉ ?
P¨2 ??5/?
=i bW¥ ?nb1 N êü N C
?y? ?
ê
??b?y? ?
ê
??b
1,ê
¥à
QD?lê
¥à
QD?l
ìê
??
^B?+
y¥2 ?? 
μ?? ([=é?ê
ìê
??
^B?+
y¥2 ?? 
μ?? ([=é?ê
1?ê?léi???1ê
b
è ? CPU¥
7i ?ê
???l ?/¥
7i ?ê
???l ?/
struct status
{ unsigned sign,1; /*?|S??|S? */
unsigned zero,1; /*
,S?
,S? */
unsigned carry,1; /*éêS?éêS? */
unsigned parity,1; /* 
} 
} /nS?nS? */
unsigned half_carry,1; /*?éêS??éêS? */
unsigned negative,1; /*hS?hS? */
} flags;
A ? CPU¥ 
7 i  7 y 
P¨ê
??
?3¥
7 i  7 y 
P¨ê
??
?3 1?3?1?3?1
P¨2 ??
31
P¨2 ??
31 6?3??
8
?3??
8
 5?3?b
2.
a
ü
a
ü


1y1ê
??
^B?2 ??
[ê
??ê
M
¥? ??
[ê
??ê
M
¥?
l[#ê

'ê
???¥??  ¥ ? ¨  ( D 2 ? ? 2 Ml[#ê

'ê
???¥??  ¥ ? ¨ ( D 2 ? ? 2 M
B"b


2 ê
?′
H1?i |?S?bB?1
aé1 n¥ê
 ¥ê
 
|′S?
^ 0j
2
n
-1b


3
P¨é1 0¥í
ê
 V
P a?ê
V/¥í
ê
 V
P a?ê
V/ 1?3? 7
Si% b?3? 7
Si%
è ?
struct status
{ unsigned sign,1; /*?|S??|S? */
unsigned zero,1; /*
,S?
,S? */
unsigned carry,1; /*éêS?éêS? */
unsigned,0; /*é1 0¥í
ê
¥í
ê
*/
unsigned parity,1; /* 
} 
} /nS?nS? */
unsigned half_carry,1; /*?éêS??éêS? */
unsigned negative,1; /*hS?hS? */
} flags;
e'
e'
6?S?ê
^ ??i%
?S?ê
^ ??i%
1?3??¥b
??F ?

??F ?

1?é1 0¥í
ê

[ a¥
¥í
ê

[ a¥
3?ê
V/
?ê
V/
1?3? 7
Si%B
]¨
?3? 7
Si%B
]¨
2?
?
3?b


4

1?ê
A?i%
?ê
A?i%
1?i%?í
Yè
?i%?í
Yè
113???
t
3???
t
2?b ?T'?í? ?
,
?b ?T'?í? ?
,
ê
5V/
ê
5V/
1??í 7
Si%?ê
b
??í 7
Si%?ê
b


5 V[¨
 V[¨
%da%xa%u

%o?ì
T3?
?ì
T3?
[?
?
T
{ê
b
[?
?
T
{ê
b


6
′Vr
T??¨ê
H"d1 ?

′Vr
T??¨ê
H"d1 ?
|ê
D1??
b
L
¨·?
LCê4E
???
{ ???
i¨·?
LCê4E
6?
?b
? ??lB? int?B?
F?B?
F ai¨·? p·_
b
? ?¨·?
LCò?
Fí
í¥
{ ?b¨·?
LCò?
Fí
í¥
{ ?b
? 訷?`ùò?
Fí
í
LCê4E
?b¨·?`ùò?
Fí
í
LCê4E
?b
? é
{
?2Tb
{
?2Tb
void main( )
{ int a[M],n,i,j,min,temp,*p,*q;
printf(" h
{ ?
?
 h
{ ?
?
 \n");
for(p=a; p<a+M; p++) scanf("%d",p); /*
{ ?

{ ?
*/
printf("
? -

? -
 \n");
for(p=a; p<a+M; p++) printf("%d ",*p);
for(i=0; i<M-1; i++) /* 1; i++) /* ê4E
?ê4E
? */
{ q=&a[i];
for(p=&a[i+1]; p<a+M; p++)
if(*p<*q) q=p;
temp=a[i]; a[i]=*q; *q=temp;
}
printf("\n
?a

?a
 \n");
for(p=a; p<a+M; p++) printf("%d ",*p);
}