日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

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

發布時間:2025/3/15 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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语言例子,编译没通过.不知道错在哪里[求助]的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。