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

Discussion

Which of the following declaration throw run-time error?

  • A.int **c = &c;
  • B.int **c = &*c;
  • C.int **c = **c;
  • D.None of the mentioned

Answer: D

Correct answer: None of the mentioned

None of the three reaches run time. Each is a type error caught at compilation: &c in the first has type int ***, the second is the same after the & and * cancel, and the third dereferences c twice in its own initialiser. A run-time error would require a program that compiles first.

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

Post your comment

Please log in or register to post a comment.