Char array and char pointer : Char Array « Data Type « C++






Char array and char pointer

   
#include <iostream>
using namespace std; 
int main(void){
   char *array = new char[256];
   char *target, *destination;
   
   int i;

   target = new char[256];
   for (i = 0; i < 256; i++) {
     array[i] = 'A';
     target[i] = 'B';
   }

   destination = new char[256];
   for (i = 0; i < 256; i++) {
     destination[i] = target[i];
     cout << destination[i] << ' ';
   }
}
  
    
    
  








Related examples in the same category

1.use char array as string
2.use getline to read char array based string
3.Use cin.getline to read a char array based string
4.Use new operator to allocate memory for char array