1. ## Pointers and arrays

Could anyone give me a crash course on using a dynamically allocated pointer array to use pointers within it to point to values in an array?

2. do you mean creating pointers to pointers using malloc...
like the one below..

Code:
```---------------------------------------

[  ]
|
|
[  ]------[][][][]
[  ]------[][][][]
[  ]------[][][][]

----------------------------------------```

3. Uh.. heres an attatched crappy photoshop of what I'm trying to do. Sorting an array using two pointer arrays full of pointers to the array, not values.

4. ## Re: Pointers and arrays

Originally posted by OttoDestruct
Could anyone give me a crash course on using a dynamically allocated pointer array to use pointers within it to point to values in an array?

char ** array = new char* [size];

5. Alright... I'm now getting core dumps and I can't see why.. then again I don't understand pointers at all... this is supposed to look at array and sort the pointers of pAscending without modifying whats inside array...

Code:
```void sortascend (int array[], int **pAscending)
{
int i;

void exchangelargest (int[], int**, int);

for (i = 0; i < 5; i++)
exchangelargest (array, pAscending, i);
} // sortascend

void exchangelargest (int array[], int **pAscending, int i)
{
int walker;
int largest;
int *temp = *pAscending;
largest = i;

for (walker = i+1; walker <= 5; walker++)
{
if (array[walker] > array[largest])
largest = walker; // if

temp = *(pAscending+i);
*(pAscending+i) = *(pAscending+largest);
*(pAscending+largest) = temp;
} // for
}```