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;
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
Обратная Связь
Зарегистрируйся сейчас
или Подпишись на будущие тесты