User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 456,479 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,807 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser: Programming Forums

Array limit

Join Date: Sep 2003
Location: San Diego, CA, USA
Posts: 75
Reputation: Valmian is an unknown quantity at this point 
Rep Power: 6
Solved Threads: 0
Valmian Valmian is offline Offline
Junior Poster in Training

Re: Re: Array limit

  #3  
Sep 16th, 2003
Use dynamic memory allocation.
In C++ (didn't test):

char * getstring()
{
fflush (stdin); //don't have to do it
char * string=NULL;
char * temp=NULL;
int size =2
scanf(""); //to get buffer input
char ch;
do
{
delete [] string;
string = new char[size];
memcpy (string, temp, sizeof(temp));
delete[]temp;
ch = getc(stdin);
string[size-2] =ch;
temp = new char [size];
memcpy(temp, string, sizeof (string));
size++;
} while (ch!='\n'); //change the quiting value if you want to whatever
return string;
}
void main (void)
{
char * string = getstring();
}
Reply With Quote  
All times are GMT -4. The time now is 2:47 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC