How to copy character from string to char variable in C++

1 Answer

0 votes
#include <iostream>

using namespace std; 
  
int main() 
{                       
    string s = "cPP pRograMMinG"; 
    
    char ch = s[4];
     
    cout << ch;
    
    return 0; 
} 
 
 
  
  
/*
run:
  
p
  
*/

 



answered Nov 12, 2019 by avibootz

Related questions

1 answer 188 views
1 answer 211 views
1 answer 186 views
1 answer 206 views
1 answer 167 views
1 answer 179 views
1 answer 187 views
...