expect the outputmain(){printf("\nab");printf("\bsi");printf("\rha");}
got the ans as hai...can u explain how it has come
yaa here's the explanation..\n newline character: starts from 1st position of a new line\b backspace: moves one space back and then starts printing \r carriage return : this will prompt to the starting position of a current lineprintf("\nab"); output: abprintf("\bsi); output: asi /* moves one position left and executes of current line and b will overwritten*/printf("\rha"); output:hai /* the starting postion is "a" then "ha" will be overwritten on "as" and "i" remains the same ..hence teh output is "hai"
This comment has been removed by the author.
got the ans as hai...
ReplyDeletecan u explain how it has come
yaa here's the explanation..
ReplyDelete\n newline character: starts from 1st position of a new line
\b backspace: moves one space back and then starts printing
\r carriage return : this will prompt to the starting position of a current line
printf("\nab"); output: ab
printf("\bsi); output: asi /* moves one position left and executes of current line and b will overwritten*/
printf("\rha"); output:hai /* the starting postion is "a" then "ha" will be overwritten on "as" and "i" remains the same ..hence teh output is "hai"
This comment has been removed by the author.
ReplyDelete