Printf MCQ 10 : Backslash Character in Printf
Printf Multiple Choice Questions : Backslash Character in Printf
Question : Guess the output of Program
#include<stdio.h> #include<conio.h> void main() { clrscr(); char *str1="Indii"; char *str2="ian"; printf("%s\b\b%s",str1,str2); getch(); }
Options :
- Indiiian
- ianindii
- Indian
- Indiian
[toggle title=”Output”]Indian[/toggle]
Switch to Printf MCQ Home : Click Here
How and Why ?
- ‘b’ - Backslash Character Moves Cursor Position one Character Back
- In Printf there are two ‘b’ so It Moves Cursor Position on 4th Position ‘i’ (Indii)
- After it Overwirte “ii” by “ian” and gives “indian”