标题: 二个C语言例子,编译没通过.不知道错在哪里[求助]
dpj
中级工程师
Rank: 3Rank: 3



UID 688
精华 0
积分 2228
帖子 2228
威望 9
金钱 4454
阅读权限 30
注册 2008-4-20
状态 离线
发表于 2008-4-21 23:03  资料  短消息  加为好友 

二个C语言例子,编译没通过.不知道错在哪里[求助]

二个C语言例子,编译没通过.不知道错在哪里[求助]以前都用汇编,C语言没弄过. 完全照书上的二个C语言例子,编译没通过.不知道错在哪里,请求帮助.谢谢 第一个程序: #include<REG51.H>  #define uchar unsigned char  #define uint unsigned int  uchar code SEG7[10]={0xc0,0xf9,0xa4,  0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,}  void delay(uint k)   {  uint i,j  for(i=0;i<k;i  ){  for(j=0;j<121;j  )  {;}}  }  void main(void)  {  uchar m=0,n=0  P0=SEG7[n]  P1=SEG7[m]  delay(3000)  P0=0xff  P1=0xff  P2=0xff     {     uchar m=8,x=6     P0=SEG7[n]     P1=SEG7[m]     P2=SEG7[x]     delay(3000)     P0=0xff     P1=0xff     P2=0xff     }   P0=SEG7[n]   P1=SEG7[m]   delay(3000)   while(1) } /*compiling no2c.c... no2c.c(1): warning C315: unknown #directive 'includ' NO2C.C(6): error C141: syntax error near 'void' NO2C.C(7): error C141: syntax error near '{' NO2C.C(9): error C141: syntax error near 'for' NO2C.C(9): error C141: syntax error near '=', expected ')' NO2C.C(9): error C129: missing ';' before '<' no2c.c - 5 Error(s), 1 Warning(s).*/ 第二个程序:   #include<reg51.h>          /*item 1*/    void msec(unsigned int);   /*item 2*/    void main(  )    {    unsigned  char array[10]     unsigned char i;      while(1)                   /*item 3*/      {      for(i=0;i<=9;i  )          /*item 4*/        {        array=P2=P0        /*单片机的C语言应用程序设计P89*/        msec(100)         }       }      }   void msec(unsigned int x){   unsigned char j;   while ((x--)! =0){    for(j=0,j<125;j  )    {;}     }    } /*compiling no1c.c... NO1C.C(6): error C141: syntax error near 'unsigned' NO1C.C(11): error C202: 'p2': undefined identifier NO1C.C(12): error C141: syntax error near 'msec' NO1C.C(13): error C141: syntax error near '}' NO1C.C(18): error C141: syntax error near '!' NO1C.C(18): error C141: syntax error near '=' NO1C.C(18): error C141: syntax error near ')' NO1C.C(19): error C141: syntax error near ')' no1c.c - 8 Error(s), 0 Warning(s).*/

顶部
[广告]
 


Google

当前时区 GMT+8, 现在时间是 2008-9-7 13:44
粤ICP备07500170号

By Discuz! 5.5.0 © 2007-2008
Processed in 0.062144 second(s), 6 queries , Gzip enabled

清除 Cookies - 联系我们 - Autooo! Inc. - Archiver - 繁体中文