2014-10-19 43 views
-3
#include <stdio.h> 
#include <stdlib.h>  
#include <math.h> 

typedef struct tagPoint 

{  
double x, y; 
} point, *pPoint; 

typedef struct tagSource 
{  
point location;  
float power; 
} source, *pSource; 

typedef struct 

{ 


{ 
    struct tagSource tagSource[100],random [2]; 
     struct tagPoint}; 

double spl(double w, double r); 
double spl_total(struct tagSource *srcs, int count, struct tagPoint dest); 
double distance(struct tagPoint p1, struct tagPoint p2); 
double power(double w); 
int sort(struct tagSource *srcs, int count); 
int display(struct tagSource *srcs, int count); 


int main (int argc, char *argv[]) 
{ 

錯誤消息如下:C:15:預期說明符限定符列表前「{」令牌C編程錯誤:之前預計符限定符列表「{」

我試圖查找如何解決這個問題,但我處於死衚衕。請幫我修補這個。由於

+0

您應該改進您的代碼格式。爲什麼你沒有用對應的'}'關閉最後一個''''?與第19行相同。 – ericbn 2014-10-19 14:05:46

+0

第15行是'} source,* pSource;'是嗎? – 2014-10-19 14:06:47

+0

請在發佈之前清理你的代碼,這是一個完整的混亂。 – 2014-10-19 16:33:39

回答

0

至少可以說變化:

int main (int argc, char *argv[]) 
;{ 

int main (int argc, char *argv[]) 
{ 
+0

它仍然讀取相同的錯誤 – Rico 2014-10-19 14:03:11

0

你不能有功能的簽名後定義一個分號。所以你只需要在int main (int argc, char*argv[])之後刪除;

0
typedef struct 

{ 


{ 
    struct tagSource tagSource[100],random [2]; 
     struct tagPoint}; 

這裏有兩個{。刪除其中任何一個。另外,更改

int main (int argc, char *argv[]) 
;{ 

int main (int argc, char *argv[]) 
{ 

完成這些修改後,錯誤將會消失!

相關問題