Search
 
SCRIPT & CODE EXAMPLE
 

CPP

string to char array c++

std::string myWord = "myWord";
char myArray[myWord.size()+1];//as 1 char space for null is also required
strcpy(myArray, myWord.c_str());
Comment

c++ string to char array

const char *array = tmp.c_str(); //For const char array
char *array = &tmp[0]; // If you need to modify the array
Comment

c++ string to char array

std::string strCoffee = "Nescafe";
const char *charCoffee = strCoffee.c_str();
Comment

PREVIOUS NEXT
Code Example
Cpp :: cpp vector2 
::  
Cpp ::  
Cpp :: create copy constructor c++ 
::  
::  
:: concat two vectors c++ 
:: even and odd sum in c++ 
::  
Cpp ::  
Cpp ::  
Cpp ::  
:: cpp when use size_t 
::  
Cpp :: getline(cin string) not working 
Cpp ::  
:: 2d vector in cpp 
::  
Cpp :: convert int to string in c++ 
Cpp :: c++ Program to check if a given year is leap year 
::  
Cpp :: how to initialize 2d array with values c++ 
Cpp ::  
::  
Cpp ::  
Cpp ::  
:: add matic mainnet to metamask mobile 
:: fill two dimensional array c++ 
::  
::  
ADD CONTENT
Topic
Content
Source link
Name
3+7 =