Array and pointer

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
2,640件の閲覧回数
lionking1
Contributor I

Hi members,

 

I have a project of making c code algorithm for MC9S08DZ60 with CW V6.3. I started a simple step to test array and pointer. But I always got error when compiling. I am a newbie for embedded program. So anybody can help?

 

Thanks!

 

David

#include "math.h"#include "MC9S08DZ60.h"void main(void) {  float a[]={10.2, 14.7, 17.4, 21.2, 26.7};  float *pa;  float x;      pa=&a[0];  x=*(pa+1);      for(;;)   /* please make sure that you never leave main */}
ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,695件の閲覧回数
Navidad
Contributor III

It seems to me that you are missing a semicolon after for( ; ; ) .

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
1,695件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee

What error do you get?

 

0 件の賞賛
返信
1,695件の閲覧回数
lionking1
Contributor I

It shows at last line. and error is:

Error   : C2450: Expected:  { IDENT auto break case const continue default do extern for goto if register return static switch typedef
volatile while __asm __interrupt      

main.c line 17   

Error   : Compile failed

0 件の賞賛
返信
1,696件の閲覧回数
Navidad
Contributor III

It seems to me that you are missing a semicolon after for( ; ; ) .

0 件の賞賛
返信
1,695件の閲覧回数
lionking1
Contributor I

It runs. I carelessly erased it from template. thank you!

0 件の賞賛
返信