c语言如何发现错误在哪里,二个C语言例子,编译没通过.不知道错在哪里[求助]
發表于:2007/12/17 8:30:00
#0樓
以前都用匯編,C語言沒弄過.
完全照書上的二個C語言例子,編譯沒通過.不知道錯在哪里,請求幫助.謝謝
第一個程序:
#include
#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
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 ? ? ? ? ?/*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[i]=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).*/
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的c语言如何发现错误在哪里,二个C语言例子,编译没通过.不知道错在哪里[求助]的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C++ 静态成员函数
- 下一篇: c语言怎么在编码时改变颜色,怎么给贪吃蛇