copies one string to another with pointers : string create « Data Types « C++ Tutorial






#include <iostream>  
  using namespace std;  
    
  int main(){  
     void copystr(char*, const char*);  
     char* str1 = "this is a test";  
     char str2[80];               
    
     copystr(str2, str1);         
     cout << str2 << endl;        
     return 0;  
  }  
  void copystr(char* dest, const char* src){  
     while( *src )                
        *dest++ = *src++;         
     *dest = '\0';                
  }








2.23.string create
2.23.1.Create a string base on the start and end of another string
2.23.2.displays a string with pointer notation
2.23.3.copies one string to another with pointers