stefsun
Joined: 23 May 2007 Posts: 22
|
Definition local variable question |
Posted: Mon Mar 03, 2008 2:47 am |
|
|
Definition of some local variables, the compiler show
"A numeric expression must appear here"
when they are Defined as global variable ,they are not wrong, do not they can be defined as local variables?
Code: |
#include <18F4523.h> // PICF4523 header file
#device ADC=12 // 12 bits ADC
#use delay(clock=10000000) // for 10Mhz crystal
#fuses XT, NOWDT, NOPROTECT, NOLVP // for debug mode
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, PARITY=N,BITS =8,stream=MYPC)
main()
{
for(int i=0;i< 100;i++)
printf("good");
}
|
the complier show
Quote: | *** Error 51 "G:\Microchip\123\123.C" Line 11(5,8): A numeric expression must appear here
*** Error 12 "G:\Microchip\123\123.C" Line 11(13,14): Undefined identifier i
*** Error 12 "G:\Microchip\123\123.C" Line 11(20,21): Undefined identifier i
|
when the 'i' is defined as global variable, no any error |
|