/ Forside / Teknologi / Udvikling / C/C++ / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
C/C++
#NavnPoint
BertelBra.. 2425
pmbruun 695
Master_of.. 501
Bech_bb 500
kyllekylle 500
jdjespers.. 500
gibson 300
scootergr.. 300
molokyle 287
10  strarup 270
Converting pointers
Fra : Andreas Vinther


Dato : 27-05-07 15:25

I need to re-structure some code in a program I wrote som time ago

I'd like to reuse my code instead of having to rewrite the lot. That
leads me to my question.

I have the following two pointers:

   char   ***pppValues;
   char   **ppValues;

The relation between the two is:

   ppValues = *pppValues;

Now I need to rewrite the following statement:

   ppValues[index]

So that I have a similar statement with the same value/meaning, but it
must be rewritten to use pppValues instead of ppValues.

I have tried the following statements without luck.

   *pppValues[index]
   *(pppValues[index])
   *(pppValues)[index]
   *((pppValues)[index])
   (*pppValues)[index]
   *((*pppValues)+index)

None of which provides me with the correct result.

I don't usually have problem coverting my pointers, but im tired and
can't think straight right now.

I'd be very greatful if someone takes the time to help me, as I've
stared myself blind, without getting the correct result.

If i'm som lucky that someone can spot the problem right away, I'd also
like the following statement rewritten. But it ought to be quite easy if
the statement above has been correctly rewritten.

   *(unsigned long *)ppValues[index]

Thanks a lot in advance
/Andreas Vinther, Denmark.

 
 
Søg
Reklame
Statistik
Spørgsmål : 177554
Tips : 31968
Nyheder : 719565
Indlæg : 6408857
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste