SHARE
TWEET

Untitled

a guest Dec 11th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <Windows.h>
  4. #include <thread>
  5. #include <string>
  6. #include <cstring>
  7.  
  8.  
  9. using namespace std;
  10.  
  11. // driver code
  12. int main()
  13. {
  14.     // assigning value to string s
  15.     string s = "geeksforgeeks";
  16.  
  17.     int n = s.length();
  18.  
  19.     // declaring character array
  20.     char char_array[n + 1];
  21.  
  22.     // copying the contents of the  
  23.     // string to char array
  24.     strcpy(char_array, s.c_str());
  25.  
  26.     for (int i = 0; i < n; i++)
  27.         cout << char_array[i];
  28.  
  29.     return 0;
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top