conditional if statement

i want use if satement, to do something for the one time, example:

main(){
char k;
k=0;

while(1){

if(k==0){
printfLCD("please only one time\n");
k=1;
}//end if

printfLCD("test message\n");

}//end while
}//end main

but it isnt work, program enters the if statement infinite time. where is the error?, there is anyything about keilc51, which is i dont know? i use upsd3434 8051 microcontroler, sory for my nglish

Parents
  • In addition to checking your XDATA, are you sure that is exactly the code that you compiled and ran?

    ie, did you copy it from your source file, and paste it into your post?

    If you manually re-typed it, it is quite possible that you inadvertently fixed a typo in the process...

Reply
  • In addition to checking your XDATA, are you sure that is exactly the code that you compiled and ran?

    ie, did you copy it from your source file, and paste it into your post?

    If you manually re-typed it, it is quite possible that you inadvertently fixed a typo in the process...

Children
More questions in this forum