Check out example codes for "how to print eachh chars in string data type in c++". It will help you in understanding the concepts better.

Code Example 1

// CPP program to convert string 
// to char array 
#include <bits/stdc++.h> 
  
using namespace std; 
  
// driver code 
int main() 
{ 
    // assigning value to string s 
    string s = "geeksforgeeks"; 
  
    int n = s.length(); 
  
    // declaring character array 
    char char_array[n + 1]; 
  
    // copying the contents of the 
    // string to char array 
    strcpy(char_array, s.c_str()); 
  
    for (int i = 0; i < n; i++) 
        cout << char_array[i]; 
  
    return 0; 
}

Code Example 2

// CPP program to convert string 
// to char array 
#include <iostream> 
#include <string.h> 
  
using namespace std; 
  
// driver code 
int main() 
{ 
    // assigning value to string s 
    string s("geeksforgeeks"); 
    // declaring character array : p 
    char p[s.length()]; 
  
    int i; 
    for (i = 0; i < sizeof(p); i++) { 
        p[i] = s[i]; 
        cout << p[i]; 
    } 
    return 0; 
}

Learn ReactJs, React Native from akashmittal.com