Undefined reference to 'swap'

closed account (yqoET05o)
Hey everyone, new to the forum since looking for help since I'm new to C/C++ in general. I'm trying to get this bubble sort method working and I think it is, but when I try to run it I keep getting the issue of it being undefined. I know it's probably something stupid but not too sure how to apply to my code.

1
2
3
4
5
6
7
8
	int j;
	for (i = 0; i < size; i+= 1) {
		for (j = i - 1; j >= 0 && int_array[j] > int_array[j + 1]; j+= 1) {
			int temp = int_array[j];
                	int_array[j] = int_array[j + 1];
        	       	int_array[j + 1] = temp;
		}
	}


Do I need to return the value?
Last edited on
swap(int_array, j);

int_array is a int*, j is an int.

What's meant to happen when you ask an int* and an int to swap? That doesn't make any sense.
closed account (yqoET05o)
I take it swap is calling a function?
Topic archived. No new replies allowed.