Consider the following C program void fint short void main int i 100 short s 12 short p s call to f Which one of the following expressions when placed in the blank above will NOT result in a type checking err
The Eduladder is a community of students, teachers, and programmers just interested to make you pass any exams. So we solve previous year question papers for you.
See Our team
Wondering how we keep quality?
Got unsolved questions?

Ask Questions
Hey! Want to work with us? Our youtube channel See our Jd Want to apply? Do it today

Use Me  ?

New searches
Gate-cs-2016-->View question


Consider the following C program. void f(int, short); void main() { int i = 100; short s = 12; short *p = &s; __________ ; // call to f() } Which one of the following expressions, when placed in the blank above, will NOT result in a type checking err


(A) f(s,*s)
(B) i = f(i,s)
(C) f(i,*s)
(D) f(i,*p)



By:13priya

Taged users:


Likes:
Be first to like this question

Dislikes:
Be first to dislike this question

Talk about thisDelete|Like|Dislike|


Answers

Answer is: f(i,*p)
Explanation: i is integer and *p is value of a pointer to short.
1) f(s, *s) is wrong because we are passing ā€œ*Sā€ as second argument check that S is not a pointer variable .So error
2) i=f(i, s) 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) f(i, *s) is wrong because of the same reason why option 1 is wrong
4) So the option f(i, *p) is correct.

Aparna-Dasgupta

Likes:
Be first to like this answer

Dislikes:
Be first to dislike this answer
Talk about this|Once you have earned teacher badge you can edit this questionDelete|Like|Dislike|
------------------------------------

Can you help us to add better answer here? Please see this



Not the answer you're looking for? Browse other questions from this Question paper or ask your own question.

Join eduladder!