參考書本範例,卻錯誤一堆的C語言範例..
請教一下,以下的程式是在c語言課本上看到的
我在dev-c++內編譯,我的系統會給我這樣的回應:
11 C:\Documents and Settings\123test\桌面\1.c parse error before '{' token
13 C:\Documents and Settings\123test\桌面\1.c parse error before "for"
14 C:\Documents and Settings\123test\桌面\1.c parse error before numeric constan
t
14 C:\Documents and Settings\123test\桌面\1.c conflicting types for `functiona'
4 C:\Documents and Settings\123test\桌面\1.c previous declaration of `functiona'
14 C:\Documents and Settings\123test\桌面\1.c [Warning] data definition has no
type or storage class
16 C:\Documents and Settings\123test\桌面\1.c parse error before string constant
16 C:\Documents and Settings\123test\桌面\1.c [Warning] data definition has no
type or storage class
21 C:\Documents and Settings\123test\桌面\1.c conflicting types for `functiona'
14 C:\Documents and Settings\123test\桌面\1.c previous declaration of
`functiona'
我的程式碼如下
麻煩各位幫忙了
謝謝!
#include<dos.h>
#include<stdlib.h>
#define SIZE 100
void functiona(int a[], int size);
main()
{
int a[SIZE] = {0};
int i =0;
for(i = 0; i <100; i++){a[i] = {1};}
for(i = 0; i <100; i++){printf("%d",a[i]);}
functiona(a , SIZE);
//printf("\n%.2f",2.13);
system("PAUSE");
}
void functiona(int a[], int size)
{
int i,total = 0;
for(i = 0; i < 100; i++)
total += a[i];
system("PAUSE");
}
--
┌─────◆KKCITY◆─────┐KKMAN團隊 全新力作 ◎◎KKBOX◎◎
│ bbs.kkcity.com.tw │知名歌手通通都有 所有新歌想聽就聽
└──《From:218.169.106.32 》──┘※※ 內容豐富多元的線上音樂台 ※※
--
推
07/19 02:17, , 1F
07/19 02:17, 1F
推
07/19 02:17, , 2F
07/19 02:17, 2F
推
07/19 02:20, , 3F
07/19 02:20, 3F
推
07/19 02:20, , 4F
07/19 02:20, 4F
推
07/19 02:20, , 5F
07/19 02:20, 5F
推
07/19 02:23, , 6F
07/19 02:23, 6F
推
07/19 02:24, , 7F
07/19 02:24, 7F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
Programming 近期熱門文章
PTT數位生活區 即時熱門文章