GATE | GATE-CS-2016 (Set 1) | Question 22
Consider the following C program.
Which one of the following expressions, when placed in the blank above, will NOT result in a type checking error?
(A) f(s, *s)
(B) i = f(i,s)
Explanation: i is integer and *p is value of a pointer to short.
1) Option 1 is wrong because we are passing “*S” as second argument check that S is not a pointer variable .So error
2) Second option is we are trying to store the value of f(i,s) into i but look at the function definition outside main it has no return type. It is simply void so that assignment is wrong. So error
3) Option 3 is wrong because of the same reason why option 1 is wrong
4) So option d is correct.
Attention reader! Don’t stop learning now. Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.
Learn all GATE CS concepts with Free Live Classes on our youtube channel.