Array and pointer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Array and pointer

Jump to solution
1,623 Views
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 */}
Labels (1)
Tags (1)
0 Kudos
1 Solution
678 Views
Navidad
Contributor III

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

View solution in original post

0 Kudos
4 Replies
678 Views
CompilerGuru
NXP Employee
NXP Employee

What error do you get?

 

0 Kudos
678 Views
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 Kudos
679 Views
Navidad
Contributor III

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

0 Kudos
678 Views
lionking1
Contributor I

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

0 Kudos