Author Message

Hi folks,
given
char * pcities;
char * cities[5] = {"San Diego", "Miami", "New York",
"Oklahoma City", "St. Louis"};
pcities = *(cities+0); // assuming 0066fd5c
0066FD6C  4C 94 42 00 60   81  42   00  30   81  42   00  48 81 42 00
0066FD7C  3C 81 42 00 CC CC CC CC CC CC CC CC 05 00 00 00

0042944c = "San Diego"
00428160 = "Miami"
00 428130 = "New York"
00428148 = "Oklahoma City"
0042813c = "St Louis"

00428130  4E 65  77 20 59 6F 72 6B 00 00  00 00 53 74 2E 20  New York....St.
00428140  4C 6F 75 69 73 00  00 00 4F 6B 6C 61 68 6F 6D 61  Louis...Oklahoma
00428150  20  43 69 74 79 00  00 00 00 00  00 00 00  00 00 00
City...........
00428160  4D 69 61 6D 69 00  00 00 00 00  00 00 4D 69 63 72  Miami....

How? can i cast ?? to enable me to use a pointer (to use pointer arithmetic)
to access the pointers in the
memory at 0066fd6c ie. the addresses of the strings above = 0042944c,
00428160, 00428130, 00428148
and 0042813c ?????? I know i don't HAVE to be able to access these pointers
to get at the strings, i just want to
know how (& if) it can be done?! Please. Do i have to ?cast? in order to do
this
Any help well appreciated, cheers

Ian Turnbull
(0961 931 941)

Sun, 17 Mar 2002 03:00:00 GMT
Yikes!

Quote:
> Hi folks,
> given
>   char * pcities;
>   char * cities[5] = {"San Diego", "Miami", "New York",
>                       "Oklahoma City", "St. Louis"};
>   pcities = *(cities+0); // assuming 0066fd5c
> How? can i cast ?? to enable me to use a pointer (to
> use pointer arithmetic) to access the pointers in the
> memory at 0066fd6c

pcities is unrelated to cities... it just happens to have
they same value as cities[0].  Therefore, you can't poke
around cities using pcities.

But, if you do this:

char** pcities = cities;

p+0 == cities[0]
p+1 == cities[1]
etc.

I think that's what you were asking.  Why you're doing
this is something I could ask... but I won't.

marco

Sun, 17 Mar 2002 03:00:00 GMT

 Page 1 of 1 [ 2 post ]

Relevant Pages