Why the output of this code is | \ / | ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Why the output of this code is | \ / | ?

char arr[4]={'|','\\','/'}; for(int i=0;i<4;i++) cout <<arr[i%3];

16th Jul 2020, 9:22 AM
The future is now thanks to science
The future is now thanks to science - avatar
1 Answer
+ 2
Samsil Arefeen because '|' when printed gives | '\\' when printed gives \ because here single \ is used for escape sequence '/' when printed gives / Combined gives | \ / |
16th Jul 2020, 9:37 AM
Varun N
Varun N - avatar