Using Brackets to Access Individual Characters in a String - C++ Data Type

C++ examples for Data Type:string

Description

Using Brackets to Access Individual Characters in a String

Demo Code

#include <iostream>

using namespace std;

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

Result


Related Tutorials