Array and pointer

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Array and pointer

跳至解决方案
2,635 次查看
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,690 次查看
Navidad
Contributor III

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

在原帖中查看解决方案

0 项奖励
回复
4 回复数
1,690 次查看
CompilerGuru
NXP Employee
NXP Employee

What error do you get?

 

0 项奖励
回复
1,690 次查看
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,691 次查看
Navidad
Contributor III

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

0 项奖励
回复
1,690 次查看
lionking1
Contributor I

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

0 项奖励
回复