| | |
Please help me to find error in this program .I am trying to add data to a dynamic ar
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
Please help me to find error in this program .I am trying to add data to a dynamic ar
0
#1 Aug 28th, 2008
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;
}Re: Please help me to find error in this program .I am trying to add data to a dynamic ar
0
#2 Aug 28th, 2008
Re: Please help me to find error in this program .I am trying to add data to a dynamic ar
0
#3 Aug 28th, 2008
C++ Syntax (Toggle Plain Text)
dynamicarray = new char(Size([20]); dynamicarray = tmp;
There's a classic error. Why is it so?
"We Americans got so tired of being thought of as dumb by the rest of the world that we went to the polls last November and removed all doubt."
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
Re: Please help me to find error in this program .I am trying to add data to a dynamic ar
0
#4 Aug 30th, 2008
your code :
my code :
c++ Syntax (Toggle Plain Text)
dynamicarray = new char(Size([20]);
my code :
c++ Syntax (Toggle Plain Text)
... dynamicarray = new char(Size([20])); // <-- ??? //--or dynamicarray = new char(Size(20)); //--or dynamicarray = new char[20];
Last edited by cikara21; Aug 30th, 2008 at 2:06 am.
![]() |
Similar Threads
- Tutorial: Understanding ASP classes (ASP)
- fstream Tutorial (C++)
- Programming FAQ - Updated 1/March/2005 (Computer Science)
- Need Help >> I Give Up , Cant Do This Program :'((( (Java)
- memory management in wndows 2000 (Windows NT / 2000 / XP)
- Hijackthis report, I just don't know (Viruses, Spyware and other Nasties)
- Identifying Drivers needed (Windows 95 / 98 / Me)
- This Should be Easy for You Guys! (Linux Servers and Apache)
- I've got Trojan.Holax... is this bad? (Viruses, Spyware and other Nasties)
- not-a-virusadware (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: remove extra blank spaces in a text file
- Next Thread: Help with fixing my source code
| Thread Tools | Search this Thread |
api array based binary c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock wordfrequency wxwidgets






