Dynamic char array from class dont printing the proper result : <p>i am making a project in which user will add the info of car and one function will show all the available cars.But the i cannot be able to copy names of car from one array to another here is the code.</p>

<pre><code>#include &lt;fstream&gt;
#include &lt;iostream&gt;
#include &lt;stdio.h&gt;
#include &lt;conio.h&gt;
#include &lt;string.h&gt;
using namespace std;

const int SIZE=10;

class car
{
   public:
int car_no=0;
char car_name[SIZE][20];
char car_model[SIZE][20];
char car_colour[SIZE][20];
char reg_id[SIZE][20];
int rate_per_day[SIZE];
char cars_in_lot[SIZE][20];
};

addcar()
{
    char choice;
    do{

   car*newcar=new car;

    cout&lt;&lt;"\t\t\t\t(-&gt;)  Name : ";
    cin&gt;&gt;newcar-&gt;car_name[newcar-&gt;car_no];
    strcpy(newcar-&gt;cars_in_lot[newcar-&gt;car_no],newcar-&gt;car_name[newcar-&gt;car_no]);
    cout&lt;&lt;endl;
    cout&lt;&lt;"\t\t\t\t(-&gt;)  reg!str@t!0n number : ";
    cin&gt;&gt;newcar-&gt;reg_id[newcar-&gt;car_no];
    cout&lt;&lt;endl;
    cout&lt;&lt;"\t\t\t\t(-&gt;)  c0l0ur : ";
    cin&gt;&gt;newcar-&gt;car_colour[newcar-&gt;car_no];
    cout&lt;&lt;endl;
    cout&lt;&lt;"\t\t\t\t(-&gt;)  Model : ";
    cin&gt;&gt;newcar-&gt;car_model[newcar-&gt;car_no];
    cout&lt;&lt;endl;
    cout&lt;&lt;"\t\t\t\t(-&gt;)  Rate of Rent Per Day : ";
    cin&gt;&gt;newcar-&gt;rate_per_day[newcar-&gt;car_no];
    newcar-&gt;car_no++;
    cout&lt;&lt;"Want to add another car [y/n]"&lt;&lt;endl;
    cin&gt;&gt;choice;
    }while(choice == 'y' || choice == 'Y');

}
void show_cars_in_lot()
 {
      cout&lt;&lt;"Avaialable Cars in Lot are : "&lt;&lt;endl;
      car*newcar=new car;
      for(int i=0;i&lt;SIZE;i++)
      cout&lt;&lt;i+1&lt;&lt;"\t"&lt;&lt;newcar-&gt;cars_in_lot[i]&lt;&lt;"\t"&lt;&lt;newcar-&gt;car_colour[i]     &lt;&lt;"\t"&lt;&lt;newcar-&gt;car_model[i]&lt;&lt;"\t"&lt;&lt;newcar-&gt;reg_id[i]&lt;&lt;endl;
getch();
}

void display1()
  {

cout&lt;&lt;"\t\t\t(1)  Show Cars in Lot"&lt;&lt;endl;
cout&lt;&lt;"\t\t\t(2)  Add Cars"&lt;&lt;endl;
 }// end of display1

int main()
 {
  char option;
  int desire_car;
do
{
    int choice;
    display1();
    cout&lt;&lt;"Enter Your Choice : ";
    cin&gt;&gt;choice;
    switch(choice)
    {
    case 1:
        show_cars_in_lot();break;
    case 2:
        addcar();break;
    default:
    cout&lt;&lt;"You Entered Wrong Input"&lt;&lt;endl;
    }
cout&lt;&lt;"Go To Main Menu [y/n]";cin&gt;&gt;option;
}while(option == 'y' || option == 'Y');

return 0;
  }
</code></pre>
