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.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes