Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

convert string to char *

// CPP program for the above approach
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
 
// Driver Code
int main()
{
    char* char_arr;
    string str_obj("GeeksForGeeks");
    char_arr = &str_obj[0];
    cout << char_arr;
    return 0;
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #convert #string #char
ADD COMMENT
Topic
Name
7+7 =