Call Support +91-85588-96644
TCYonline

Login

Sign Up

Please enter a Username or Email ID
Please enter a password
Keep me logged in
Please enter your name
Please enter your mobile number
You can't leave Captcha Code empty
By submitting this form, you agree to the Terms & Privacy Policy.
OR

Sign Up via Facebook

Sign Up via Google

Sign Up via Twitter

Download Software
Tests given

Download TCY App

App Image

What would be the output or error, if any, of the following C++ code?
void main()
{
int x=30,y=10;
long int z;
z=x + long int(y);
cout<<z<<endl;
z=y + long int(z);
cout<<z;
getch();
}

 
40
40
40
50
Expression syntax error
50
40

Reply


Please type your answer before submitting.
Submit

I meant for Cpp, there is a bug in your editor which omits plus plus sign.

This is not the right answer, in C we can type cast in both the ways. x = (long int) y; and x = long int(y) Both are equal an valid statement in C