0

Left shift

This just came to my mind, is << which comes after cout, the left shift operand? If so... Why! How does this end in printing?

8th Jun 2020, 7:25 PM
GodSaturn
GodSaturn - avatar
1 Respuesta
+ 3
They're based on UNIX redirection commands <, <<, > and >> where > overwrites a file, >> appends to a file, < takes input from a file and << used for appended input. A common usage of redirection is when using cat on a unix-like system to append text to a file until you reach a delimiter like $ or EOF: cat >> myfile << EOF line of text . . . EOF In the context of cout they're not bitshifts but stream redirections, so if you want to print the result of a left/right bitshift using cout you have to parenthesize the expression.
8th Jun 2020, 8:34 PM
Gen2oo
Gen2oo - avatar