0

I have successfully completed the linear search and sort functions in the helpers.c file for problem set 3. I included the swapping steps within the sort function directly and everything worked properly. I then decided to have a go at defining a separate swap function in the helpers.c file for the sort function to call. I ensured that the swap function used pointers. Yet, the file won't compile and gives me an error message "error: called object type 'int' is not a function or function pointer". I have declared the swap function in the helpers.h header file, I have tried calling the swap function using swap(&values[j], &values[j + 1]), instead of just swap(values[j], values[j + 1]). The swap function is declared as void swap(int* a, int* b).

Any ideas where I've gone wrong?

3
  • try if this works
    – sinister
    Sep 1 '14 at 0:37
  • Thanks but I have ensured that I'm using pointers so I don't think that's the problem.
    – user1692
    Sep 4 '14 at 22:45
  • check out the very end of week 4 lecture 1 video
    – user7115
    May 13 '15 at 15:10

You must log in to answer this question.

Browse other questions tagged .