void longjmp(jmp_buf qEnvironment, int qReturn);
#include <iostream>
#include <csetjmp>
int main() {
using namespace std;
int x = 0;
jmp_buf qEnv;
// Use setjmp() and longjmp() to create a loop
int iRet = setjmp(qEnv);
cout << "Return value = " << iRet << endl;
if (x < 10) {
++x;
// This jumps back to setjmp()
longjmp(qEnv, x);
}
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.