C++ String index Use Brackets to Access Individual Characters in a String

Description

C++ String index Use Brackets to Access Individual Characters in a String

#include <iostream>

using namespace std;

int main()/*from  ww w. j ava2 s .c o  m*/
{
  string mystring;
  mystring = "abcdef";
  cout << mystring[2] << endl;
  return 0;
}



PreviousNext

Related