📄 main.lst
字号:
C51 COMPILER V6.23a MAIN 11/20/2002 01:17:34 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 #include <stdlib.h>
6 #include <string.h>
7
8 #ifdef MONITOR51 /* Debugging with Monitor-51 needs */
char code reserve [3] _at_ 0x23; /* space for serial interrupt if */
#endif /* Stop Exection with Serial Intr. */
11 /* is enabled */
12 /*------------------------------------------------
13 The main C function. Program execution starts
14 here after stack initialization.
15 ------------------------------------------------*/
16 void main (void) {
17 1
18 1 char *ptr1[4],*temp;
19 1 int i,j;
20 1 /*------------------------------------------------
21 1 Setup the serial port for 1200 baud at 16MHz.
22 1 ------------------------------------------------*/
23 1 #ifndef MONITOR51
24 1 SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */
25 1 TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */
26 1 TH1 = 221; /* TH1: reload value for 1200 baud @ 16MHz */
27 1 TR1 = 1; /* TR1: timer 1 run */
28 1 TI = 1; /* TI: set TI to send first char of UART */
29 1 #endif
30 1 /*------------------------------------------------
31 1 Note that an embedded program never exits (because
32 1 there is no operating system to return to). It
33 1 must loop and execute forever.
34 1 ------------------------------------------------*/
35 1 init_mempool (0x1000,0x500);
36 1 for (i=0;i<4;i++)
37 1 {
38 2 ptr1[i] = malloc(20) ;/*为指针数组各指针分配20字节的存储空间*/
39 2 gets(ptr1[i],20) ;
40 2 }
41 1 printf("\n") ;
42 1 printf("original string:\n");
43 1 for(i=0;i<4;i++)
44 1 printf("%s\n",ptr1[i]) ;
45 1 printf("ordinal string:\n");
46 1 for( i = 0 ; i < 3 ; i++)
47 1 for( j = 0 ; j < 4 - i - 1 ; j++)
48 1 if(strcmp(ptr1[j],ptr1[j+1])>0)
49 1 {
50 2 temp=ptr1[j];/*利用指向字符串的指针,进行指针地址的交换*/
51 2 ptr1[j]=ptr1[j+1] ;
52 2 ptr1[j+1]=temp;
53 2 }
54 1 for( i=0;i<4;i++)/*字符串输出*/
55 1 printf("%s\n" , ptr1[i]);
C51 COMPILER V6.23a MAIN 11/20/2002 01:17:34 PAGE 2
56 1 while (1) {};
57 1 }
58
59
60
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 663 ----
CONSTANT SIZE = 41 ----
XDATA SIZE = ---- 19
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 + -