Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations - NIMCET

Previous Year Question (PYQs)



Which of the following are legal statements in C programming language?

(a) int *P = &44;
(b) int *P = &r;
(c) int P = &a;
(d) int P = a;






Solution

Statement (a) is not legal because we cannot take the address of a constant value like $44$.

Statement (b) is legal because if $r$ is an integer variable, then &r gives its address and it can be stored in an integer pointer.

Statement (c) is not legal because &a gives address, but $P$ is declared as normal integer, not pointer.

Statement (d) is legal because if $a$ is an integer variable, then its value can be assigned to integer variable $P$.

So, legal statements are:

(b) and (d)



Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Ask Your Question or Put Your Review.

loading...