Machine-translated by Google. Questions are authored in English.
Top

Discussion

Choose the right declaration of longjmp() function.

  • A.void longjmp(jmp_buf environment, int value)
  • B.void longjmp(setjmp environment, int value)
  • C.void longjmp(int value, jmp_buf environment)
  • D.void longjmp(int value, setjmp environment)

Answer: A

Correct answer: void longjmp(jmp_buf environment, int value)

longjmp takes the jmp_buf saved by setjmp and an int, and restores the saved environment - whereupon setjmp appears to return that value. A value of 0 is silently changed to 1, so that the caller can always distinguish a longjmp arrival from the original call.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.