What will the following line of code print and why? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
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 Respuesta
+ 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