Answers for "c++ get nth character in string"

C++
4

c++ get nth character in string

#include <string>
#include <iostream>

int main(){
  //index string by using brackets []
  std::string string = "Hello, World!";
  //assign variable to string index
  char stringindex = string[2];
  
}
Posted by: Guest on June-15-2020

Code answers related to "c++ get nth character in string"

Browse Popular Code Answers by Language