标题: LED3.C(4): error C129: missing ';' before 'char' [打印本页]

作者: hxwt    时间: 2019-6-26 11:21
标题: LED3.C(4): error C129: missing ';' before 'char'
#include<reg52.h>
#define uchar unshigned char
#define uint unshigned int
uchar b;
uchar code table[]={0x00,0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0xff};
void ys(uint);
void main()
{

        wihle(1)
        {
                for(b=9;b>0;b++)
                {
                P1=table[b];
                ys(500);
                }
        }
}
void ys(unsigned int hs)
{
        unsigned int i,j;
        for(i=hs;i>0;i--)
        {
                for(j=125;j>0;j--);
        }
}
编译时老是出现char前面少了个分号,
求大神们帮忙看看!!!!!!!!!!!!!!


作者: wulin    时间: 2019-6-26 12:09
就这么几条语句还打错字,楼主太粗心。
#include<reg52.h>
//#define uchar unshigned char
//#define uint unshigned int
#define uchar unsigned char
#define uint unsigned int
uchar b;
uchar code table[]={0x00,0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0xff};
void ys(uint);
void main()
{
//        wihle(1)
        while(1)
        {
                for(b=9;b>0;b++)
                {
                        P1=table[b];
                        ys(500);
                }
        }
}
void ys(uint hs)
{
        uint i,j;
        for(i=hs;i>0;i--)
        {
                for(j=125;j>0;j--);
        }
}

作者: 青青梓衿    时间: 2019-6-26 14:25
unsigned char
作者: lihaijun7781    时间: 2019-6-26 17:25
用define不好,应该用typedef
typedef unsigned char u8;
作者: Ethan_58    时间: 2019-6-27 15:24
typedef 会检查语法错误,  define不会检查。
作者: wj_yuq    时间: 2019-6-27 23:42
还是多看看书和例程,熟悉熟悉关键字,不要总忙着挣黑币呦
作者: 147258369q    时间: 2019-6-28 09:29
#define uchar unsigned char
#define uint   unsinged int

注意:unsingned 的拼写




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1