What will be printed out as a reuslt of the program execution?
#include <iostream>

int main() {
  char c;
  for (c = 0; c < 155; c++) {}
  std::cout << (int) c;
}
Explanation
char type can be either signed or unsigned depending on the compiler. If it is signed, then the program will go into an infinite loop, since the maximum value for signed char = 127. Otherwise, the program will display "155" (of course, the behavior of the program will still depend on what maximum value can be stored in signed char, which is also not defined by the standard)

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Cosmo
Зареєструйся Зараз
або Підпишись на майбутні тести