Aspire's Library

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

Previous Year Question (PYQs)



How will this call assign values when the user input is `29␠w` (a space between 29 and w)? scanf("%i%c", &i, &c);





Solution

Solution: `%i` reads an integer and **skips leading whitespace**, so it consumes `29`. `%c` reads the **next character exactly as-is** (does **not** skip whitespace). The next character after `29` is the space. Therefore: $i=29$, $c=$ space `' '`.


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...