P>
Answer: No, continue statement works inside loops only.
Listed below are two examples of continue statement. Both examples show how to skip "Detail print....." in the next statements with the continue statement. They take keyboard inputs from user and if user presses the ESC key, they then skip the remaining statements like a long print and continue to the next iteration.
Example:
for(i = 0; i < 10; i++) { printf("Iteration %d\nPress Esc to skip long print", i); if(getch() == 27)/*Esc pressed*/ { continue; } printf("Detail print...."); }
i = 0; while(i < 10) { printf("Iteration %d\nPress Esc to skip long print", i); i++; if(getch() == 27)/*Esc pressed*/ { continue; } printf("Detail print...."); }
About our authors: Team EQA
You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.
Most popular
Questions index C Questions C++ Questions Win32 MFC COM/DCOM DLL Questions
Compilers & Editors
Download Visual Studio Download XCode Download Visual Studio Code Android studio install sdk Eclipse installer Best C compilers IDEs
Development system setup
Windows media creation tool MSDN subscription Ubuntu virtualbox
New updated posts
Why learn C? Calculate weighted average
Questions index C Questions C++ Questions Win32 MFC COM/DCOM DLL Questions
Compilers & Editors
Download Visual Studio Download XCode Download Visual Studio Code Android studio install sdk Eclipse installer Best C compilers IDEs
Development system setup
Windows media creation tool MSDN subscription Ubuntu virtualbox
New updated posts
Why learn C? Calculate weighted average