printing - printf does not print complete string -
it displays "hello world". why?
#include <stdio.h> int main(void) { printf("..... world\rhello\n"); return 0; }
this because \r
carriage return (cr). returns caret start of line. afterwards write hello
there, overwriting dots.
\n
(line feed, lf) on other hand used to move caret 1 line downwards, why teletypewriters had sequence cr-lf, or carriage return followed line feed position caret @ start of next line. unix did away , lf on own. cr still exists old semantics, though.
Comments
Post a Comment