In article <Oqz4l8geKHA.3960@TK2MSFTNGP02.phx.gbl>,
chncc@noemail.noemail says...
Mike Copeland wrote:
My question is: what's the best technique or language feature for
storing and accessing individual Cities & States via the ZIP code value
(10000-99999)? I would think a declared array of strings, stored and
accessed via the ZIP value won't work, as such an array would be too
large for the compiler (VS6.0).
Why do you think that it will not work? It is quite small amount of
memory. Under my VS6 SP5+PP it works fine:
char **p;
// C++
p = new char *[90000];
delete[] p;
/* C */
p = malloc(sizeof(char *[90000]));
free(p);
p = malloc(90000 * sizeof(char *));
free(p);
-- best regards
Cezary Noweta
I didn't express myself clearly enough 8<{{
I need to declare an array of strings (char[17]) that each contain
the City-State strings for each ZIP code. I would need ~90000 such
strings and wish to quickly access each one based on the ZIP code
(integer) value. Thus, I want to use 85004 to "find" the string
"Phoenix AZ" that I'd have in that array location. I'd expect a
90,000 strings array as a single declaration to not compile (though I
haven't tried it...). And I was wondering what other technique I could
use.
size of the data is not a problem. The interesting design issue is to make
the search efficient, and you received some good advice on that.
Just do it.