Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 26
c. 4294967271 In C++, if the datatypes of two values used in calculation is different from each other, the value with datatype of lower size hierarchy will be converted to the datatype of the other value which has the higher size hierarchy. Size hierarchy : short int < unsigned short int < int < unsigned int < long int < unsigned long int Size hierarchy for floating point numbers is : float < double < long double In the question, 25u is an unsigned int. 50 is an int. So according to the above information, 50 will be converted from int to unsigned int. Hence, 25u - 50u is computed and the result of 4294967271 is obtained. // I'm not sure how the conversion works though. What I am sure of was that the answer would neither be a, b or d. // would have needed this: https://www.quora.com/How-do-I-convert-an-integer-into-an-unsigned-integer-in-C
24th May 2017, 4:54 AM
Hatsy Rei
Hatsy Rei - avatar
+ 5
@Hatsy rei I got a headache just reading that
24th May 2017, 4:53 AM
DeleteThisAccount
+ 4
Crap. I know the answer but I can't share. No, I didn't use CP, but I've ran a code like this before. I'll give a hint though, the u defines what type of integer 25 is and this is important to the Mathematical operation being performed.
24th May 2017, 4:42 AM
Steven Schneider
Steven Schneider - avatar
+ 4
@Hasty Rei is correct though.
24th May 2017, 4:54 AM
Steven Schneider
Steven Schneider - avatar
+ 4
*mindblown* Nice question, I wish that was excepted. I am going have to review that.
24th May 2017, 5:06 AM
Manual
Manual - avatar
+ 3
what is u here ,is it for unsigned
24th May 2017, 4:41 AM
Sumita
Sumita - avatar
+ 3
@Sumita Will the final answer be signed or unsigned if one integer is an unsigned?
24th May 2017, 4:52 AM
Steven Schneider
Steven Schneider - avatar
+ 3
@Ace I bet it was downvoted because people did not get it. It is a kata level question I like it. If I came accross it. I would skip it, until I compiled it.
24th May 2017, 4:58 AM
Manual
Manual - avatar
24th May 2017, 4:54 AM
Manual
Manual - avatar
+ 1
Wow @Hatsy what can you do with the data type hierarchy?
24th May 2017, 5:00 AM
Manual
Manual - avatar