C语言在STC89C52RD单片机里编程能用指针吗?
#include<stdio.h>#include<reg51.h>#include<intrins.h>typedefunsignedcharuchar;typedef...
#include <stdio.h>
#include <reg51.h>
#include <intrins.h>
typedef unsigned char uchar;
typedef unsigned int uint;
typedef bit bool;
sbit rs= P2^5;
sbit rw = P2^6;
sbit ep = P2^7;
sbit k1 = P3^4;
uchar content1[ ]={"Check now..."};
uchar content2[ ]={"Loading..."};
uchar content3[ ]={"Warning..."};
uchar content4[ ]={"Press k1"};
uchar *p[ ]={"Check now...","Loading...","Warning...","Press k1"};
以上为起始定义;
void EnterData(uchar num,uchar pos)
{
uchar i;
Init();
i=0;
Position(pos);
while(*p[num]!='\0')
{
WriteData(*p[num]);
(p[num])++;
}
}
main()
{
Init();
Delay5ms;
EnterData(0,0x00);
EnterData(1,0x40);
while(1);
}
运用到指针的子函数和主函数。
在keil3里一编译就报错。难道我用得不对了?指针不能用? 展开
#include <reg51.h>
#include <intrins.h>
typedef unsigned char uchar;
typedef unsigned int uint;
typedef bit bool;
sbit rs= P2^5;
sbit rw = P2^6;
sbit ep = P2^7;
sbit k1 = P3^4;
uchar content1[ ]={"Check now..."};
uchar content2[ ]={"Loading..."};
uchar content3[ ]={"Warning..."};
uchar content4[ ]={"Press k1"};
uchar *p[ ]={"Check now...","Loading...","Warning...","Press k1"};
以上为起始定义;
void EnterData(uchar num,uchar pos)
{
uchar i;
Init();
i=0;
Position(pos);
while(*p[num]!='\0')
{
WriteData(*p[num]);
(p[num])++;
}
}
main()
{
Init();
Delay5ms;
EnterData(0,0x00);
EnterData(1,0x40);
while(1);
}
运用到指针的子函数和主函数。
在keil3里一编译就报错。难道我用得不对了?指针不能用? 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询