2,393 views
0 votes
0 votes

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.

I think C is correct but mentioned correct ans is D how?

1 Answer

1 votes
1 votes
I think all of them throws the compile time error. Hence there is no question of asking about runtime error.

Hence the correct answer is D. None of the mentioned.

Explanation: There is a concept is C assignment that we can not write this,

int a = a;

This will create, compile time error. Because you are assigning $a$, which has not been created yet.

Related questions

0 votes
0 votes
1 answer
1
Debargha Mitra Roy asked Apr 16
67 views
#include <stdio.h int main() { int a[3] = {1, 3, 5, 7, 9, 11}; int *ptr = a[0]; ptr += sizeof(int); printf("%d", *ptr); return 0; }(Assume size of int to be $2$ bytes.)T...