Hey everybody, I need an expert's opinion on what to do here. I've been spinning my wheels for awhile on this problem and need some advice on where to go next.
//here is main (could be the issue, i don't know)
int main()
{
int nums [ 25 ];
int size = 25;
You only need one temporary variable in swap. It doesn't need to be a pointer. You should also put your code in [code][/code] tags :)
1 2 3 4 5 6
void swap(int &a, int &b)
{
int tmp = a; // hold onto the value of a for later
a = b; // replace the contents of a with b
b = tmp; // put the original contents of a into b
}
The first problem is that you have not declared a swap function with the following signature:
void swap(int **, int *);
The second being that in the swap function you currently have, you have not affected the arguements num and size in any way, you seem to be more concerned with swapping the pointers in your code that do nothing rather than swapping the varaibles you got.