Whats the mistake in this?
I have done some rectification and wrote the mistakes in the code itself as comment
my site is down so i am not able to compile your code but you can do following,
in function do not write a[1000], or try swapping elements by using temp variable don’t use swap function
let me know if you still face problem