0

Please help me to find error in this program .I am trying to add data to a dynamic array .

#include<iostream.h>
#include<conio.h>
#include<string.h>

class data
{
	private:

		char(* dynamicarray)[20];
		int size1,i;

	public:

		data(char(*tmp)[20],int Size)
		{
			dynamicarray = new char(Size([20]);
			dynamicarray = tmp;
			size1 = Size;
		}
		get()
		{
			for(i=0;i<size1;i++)
			{
				cout<<dynamicarray[i];
			}
		}
	};


	main()


	{
		 char array1[5][20] ={"tom","dick"};
		 int Size1 =5;
		 data obj;
		 obj.data(array1,Size1);
		 data g;
		 obj.get();
		 return 0;


	}
4
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by cikara21
0

Honestly speaking it looks like an absolutely senseless text written in unknown language.
May be better you present your assignment?..

0

your code :

dynamicarray = new char(Size([20]);

my code :

...
dynamicarray = new char(Size([20])); // <-- ???
//--or
dynamicarray = new char(Size(20));
//--or
dynamicarray = new char[20];
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.