[Dev-C++] Producing a endless list of strings.
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: David M. <ci...@ya...> - 2003-07-30 16:44:30
|
Ok, this is not a school assignment so please don't ask. I would like to produce a list of null terminated strings that I plan to use to test a hash function. Unfortunately I am a bit stumped as what would be the best way to create such a list. The algorithm is as follows: 1. Start with a string containing only a space. 2. Increment the first character in the string. 3. If the value of the first character is 127 (DEL) then set it to 32 (space) and increment the next character (repeat this step if that character is 127). 4. print out the string. 5. goto step 2. I know, Recursion is screaming at me to use it. Problem is, how? I am getting stuck in the wind-up section. (That and the fact that Visual C++ is giving me access violations) My other question is, does anyone else know another way? Eventually I hope to use this to create strings at least 100 chars long (possibly 1000). Could someone tell me if 100 levels using recursion cause a stack overflow? Thanks in Advance David Mcken __________________________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo http://search.yahoo.com |