Yes, as well as one before return 1, or you could have a memory leak.
Type: Posts; User: camel-man
Yes, as well as one before return 1, or you could have a memory leak.
Ahh ok, I thought he was trying to actually sort the array from beginning.
Why are you comparing to array[i-1] why not just i? You're also scanning back to back which I doubt you mean to do.
Variable is your new allocated array.
Scanf("%d",&n);
int *variable=malloc(n*sizeof(int));