We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
#include<reg51.h> typedef unsigned int u16; void main() { P0=0x01; u16 i; }
Placing a statement declaring a new variable following a statement assigning an 8-bit IO port makes the compliler report the error
syntax error near 'u16', expected '__asm' 'i': undefined identifier
If exchange 'P0=0x01;' and 'u16 i;', the compiler won't report a error, why ? Is this a bug of the compiler?
As in most cases, it is not a compiler bug, but a user bug. This is not C++. Variable declarations 'after' code is not possible in C (on the same blocklevel).