C Programming :: Basic Concepts - Discussion
518 / 90
#include <stdio.h>
void main()
{
printf("\nks");
printf("\bmi a");
printf("\rha n");
}
#include <stdio.h>
void main()
{
printf("\nks");
printf("\bmi a");
printf("\rha n");
}
Aksmiha
Bmis
Cha na
Dhamiks
Show Explanation
Line 5 will give the result as "kmi a". The escape sequence '\b'(backspace) re-writes "ks" with "kmi a".
Line 6 will give the result as "ha na". The escape sequence '\r'(carriage return) returns the control to the starting point of the string and it will rewrite "kmi a" with "ha na".
Hence, the output is ha na.
Asked In ::
Line 4 will give the result as "ks".
Line 5 will give the result as "kmi a". The escape sequence '\b'(backspace) re-writes "ks" with "kmi a".
Line 6 will give the result as "ha na". The escape sequence '\r'(carriage return) returns the control to the starting point of the string and it will rewrite "kmi a" with "ha na".
Hence, the output is ha na.
Read Full Answer
Report Error
Please Login First Click Here