Answers for "string charat in c++"

C++
4

index string c++

#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
1

c++ char define

// syntax: 
// char <variable-name>[] = { '<1st-char>',  '<2nd-char>', ... , '<Nth-char>', ''}; 

// example (to store 'Hello' in the YourVar variable): 
char YourVar[] = {'H','e','l','l','o',''}; // NOTE: the  marks the end of the char array
Posted by: Guest on April-29-2020

Browse Popular Code Answers by Language