Hi guys,
How would you sort an array using pointers BUT not change the original array or create any other integer arrays.
Please do let me know. Thanks
A
Hi guys,
How would you sort an array using pointers BUT not change the original array or create any other integer arrays.
Please do let me know. Thanks
A
Create an array of pointers to whatever type your array is. Make them point to each individual cell, and sort the list of pointers.
Quzah.
Hope is the first step on the road to disappointment.
Hi Quzah..
what would some of the code look like. As in how would I do the pointing (if you know what I mean)? I know thats the right idea. I am just having a lil difficulty w/ the code. Thanks
A
<sometype> array[SOME_SIZE];Originally posted by aspand
Hi Quzah..
what would some of the code look like. As in how would I do the pointing (if you know what I mean)? I know thats the right idea. I am just having a lil difficulty w/ the code. Thanks
A
<sometype> *somearray[SOME_SIZE];
somearray[x] = &array[y];
Basicly all you do is change the address that a given cell in 'somearray' points to, and sort it that way. The original array will remain untouched.
Quzah.
Hope is the first step on the road to disappointment.