Discussion :: C Fundamentals
-
What will be printed after execution of the following program code?
main()
{
printf("\\nab");
printf("\\bsi");
printf("\\rha");
}
Answer : Option D
Explanation :
\\n - newline - printf("\\nab"); - Prints 'ab'
\\b - backspace - printf("\\bsi"); - firstly '\\b' removes 'b' from 'ab ' and then prints 'si'. So after execution of printf("\\bsi"); it is 'asi'.
\\r - linefeed - printf("\\rha"); - Now here '\\r' moves the cursor to the start of the current line and then override 'asi' to 'hai' .
Be The First To Comment