What will be printed out as a result of the following code execution?

#include <iostream>
#include <string>

using namespace std;

int main() {
  string str("abcdefghijk");
  int index = str.length();
  index = ~index;
  while(++index) {
      cout << str.at(~index);
  }
  return 0;
}
Explanation
int typerepresents a "signed int" by default. It means that, having number "11", for example, we will obtain "-12" after a bitwise inversion.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты