I have the following:
When I compile, it always shows the error:Code:while { do something } #ifndef MQ_SEND break; #endif
Could you please help me?Code:break statement canot be outsite while, for or switch unexpected end of the file
Thanks
I have the following:
When I compile, it always shows the error:Code:while { do something } #ifndef MQ_SEND break; #endif
Could you please help me?Code:break statement canot be outsite while, for or switch unexpected end of the file
Thanks
Maybe you could try some valid c code rather than a random stream of characters.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
You are using it wrongly, please see:
do...while loop in C
Also, a break statement must be inside the loop, yours is clearly after the loop is executed.
1. When I put it to while loop, it says invalid end of the file
2. On the other server it compiles successfully
How about providing:
- Operating system(s)
- Compiler(s)
- Complete sample program (Short, Self Contained, Correct Example)
that is what is called pseudo code. Used to give the other an idea of what is to be written for a loop in this case to work, what you make the do something be is entirely up to the programmer.
Code:while ( condition is true ) { do something; } // real code while ( 1 ) { // do something printf("look I'm doing something now\n" "someone please make me stop\n"); } //leads to this int i = 0; while ( 1 ) { // do something printf("look I'm doing something now\n" "someone please make me stop\n"); i++; if ( i == 10) break; } printf("Thank you\n");
Last edited by userxbw; 12-15-2017 at 10:30 AM.
AIX 1 6 00F636064C00
compiler CC
program C
Code:while(!ORA_EOF(&qSelCda)) { qRowCount++; d2i_SendXmitRec(&row);
AIX 1 6 00F636064C00
compiler CC
program C
When I put last statement into while, it shows the errorCode:while(!ORA_EOF(&qSelCda)) { qRowCount++; d2i_SendXmitRec(&row); if (qRowcount %6 ==0) fprintf(qDebug,"\n"); ORA_CHECK_FETCH(&qSelCda); } #ifndef MQ_SEND break; #endif
unexpected end of file
> When I put last statement into while,
But it isn't in the while is it.
Look where the closing brace is.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.