title: My append function does not work as expected. C++
body: <p>I am writing my own append function to append a dynamic character array of string array2 at the end of  another dynamic character array of string array1, using a  static char buffer[50]. But the compiler generates the following errors: [Error] incompatible types in assignment of 'char' to 'char[50]'. I have tried to figure out the problem, but I don't seem to find the solution. Your help will be very appreciated. I am using Dev-C++. The code is bellow.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  
  using namespace std;
  
  char *Appendstring(char *a, char *b)  // will append b to the end of a
  {
      static char buffer[50];
      char *p=buffer=*a++;  //[Error] incompatible types in assignment of 'char' to 'char[50]'
                      //[Error] invalid conversion from 'char*' to 'char'[-fpermissive]
      p--;
      while(*p++=b++);
      p--;  //append
      while(*p++=*c++);
      return buffer;  
  
  
  }
  
  int main ()
  {
  
      string str="Displaying: ";
      string add=" Summer is coming";
  
      Appendstring(str, add);
  
      return 0;
  }
  </code></pre>