📄 main.lst
字号:
C51 COMPILER V6.23a MAIN 11/20/2002 18:17:22 PAGE 1
C51 COMPILER V6.23a, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c LARGE DEBUG OBJECTEXTEND
stmt level source
1 #include <REG52.H> /* special function register declarations */
2 /* for the intended 8051 derivative */
3
4 #include <stdio.h> /* prototype declarations for I/O functions */
5
6 #ifdef MONITOR51 /* Debugging with Monitor-51 needs */
char code reserve [3] _at_ 0x23; /* space for serial interrupt if */
#endif /* Stop Exection with Serial Intr. */
9 /* is enabled */
10 struct data1/*定义结构体类型*/
11 {
12 int day,month,year;
13 } ;
14 struct stu/*定义结构体类型*/
15 {
16 char name[20];
17 long num;
18 struct data1 birthday;
19 } ;
20 /*------------------------------------------------
21 The main C function. Program execution starts
22 here after stack initialization.
23 ------------------------------------------------*/
24 void main (void) {
25 1
26 1 int i;
27 1 struct stu *p,student[4]={{"liying",1,1978,5,23},{"wangping",2,1979,3,14},
28 1 {"libo",3,1980,5,6},{"xuyan",4,1980,4,21}};
29 1 /*定义结构体数组并初始化*/
30 1 /*------------------------------------------------
31 1 Setup the serial port for 1200 baud at 16MHz.
32 1 ------------------------------------------------*/
33 1 #ifndef MONITOR51
34 1 SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */
35 1 TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */
36 1 TH1 = 221; /* TH1: reload value for 1200 baud @ 16MHz */
37 1 TR1 = 1; /* TR1: timer 1 run */
38 1 TI = 1; /* TI: set TI to send first char of UART */
39 1 #endif
40 1 /*------------------------------------------------
41 1 Note that an embedded program never exits (because
42 1 there is no operating system to return to). It
43 1 must loop and execute forever.
44 1 ------------------------------------------------*/
45 1 p=student;/*将数组的首地址赋值给指针p,p指向了一维数组student*/
46 1 printf("\n1----Output name,number,year,month,day\n" );
47 1 for(i=0;i<4;i++)/*采用指针法输出数组元素的各成员*/
48 1 printf("%20s%10ld%10d//%d//%d\n",(p+i)->name,(p+i)->num,(p+i)->birthday.year,(p+i)->birthday.month,(p+i)
-->birthday.day);
49 1 printf("\n2----Output name,number,year,month,day\n" );
50 1 for(i=0;i<4;i++,p++)/*采用指针法输出数组元素的各成员*/
51 1 printf("%20s%10ld%10d//%d//%d\n",p->name,p->num,
52 1 p->birthday.year,p->birthday.month,
53 1 p->birthday.day);
54 1 printf("\n3-----Output name,number,year,month,day\n" );
C51 COMPILER V6.23a MAIN 11/20/2002 18:17:22 PAGE 2
55 1 for(i=0;i<4;i++)/*采用地址法输出数组元素的各成员*/
56 1 printf("%20s%10ld%10d//%d//%d\n",(student+i)->name,(student+i)->num,
57 1 (student+i)->birthday.year,(student+i)->birthday.month,
58 1 (student+i)->birthday.day);
59 1 p=student;
60 1 printf("\n4-----Output name,number,year,month,day\n" );
61 1 for(i=0;i<4;i++)/*采用指针的数组描述法输出数组元素的各成员*/
62 1 printf("%20s%10ld%10d//%d//%d\n",p[i].name,p[i].num,
63 1 p[i].birthday.year,p[i].birthday.month,
64 1 p[i].birthday.day);
65 1 while (1) {};
66 1 }
67
68
69
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 880 ----
CONSTANT SIZE = 309 ----
XDATA SIZE = ---- 125
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -