What will the following line of code print and why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What will the following line of code print and why?

#include <iostream> int main(int argc, char **argv) { std::cout << 25u - 50; return 0; }

27th Jun 2018, 11:33 AM
SOUMITRA MANDAL
SOUMITRA MANDAL - avatar
1 Answer
+ 2
The output is 4294967271, as 25u forces the output to be unsigned, and -25 underflows to 4294867271.
27th Jun 2018, 11:58 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar