Why is this code compiling without errors? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why is this code compiling without errors?

#include <iostream> using namespace std; int main() { char arr[]="SUN"; cout<<arr[1]; } The return statement is missing and still the output is 'U'

8th May 2019, 2:57 AM
Avinash Avi
Avinash Avi - avatar
7 Answers
8th May 2019, 4:03 AM
Sonic
Sonic - avatar
+ 2
Avinash Avi if you find any of such quiz questions, be sure to forward them, along side this particular question to sololearn via email at info@sololearn.com
8th May 2019, 8:15 AM
Dlite
Dlite - avatar
+ 2
Output is redirected to the console using cout output stream
8th May 2019, 3:01 PM
Sanjay Kamath
Sanjay Kamath - avatar
+ 2
Jamie💐 Hey, there's no reason for you to be sorry. Thank you for the clarification.
8th May 2019, 4:05 PM
Avinash Avi
Avinash Avi - avatar
+ 1
Jamie💐 Thank you for answering but your answer is not very clear to me. I do this same thing on PC and it returns an error. If this is compiler dependant then questions based on this concept must be dropped from the Quiz Factory.
8th May 2019, 4:53 AM
Avinash Avi
Avinash Avi - avatar
+ 1
Yeah, I will. Thanks for the help D'Lite
8th May 2019, 8:38 AM
Avinash Avi
Avinash Avi - avatar
+ 1
Hi
9th May 2019, 12:20 PM
chaminda gamage