Whats wrong?
void sort()
{
int z, i;
for(i = 1; i <= z - 1; i++)
{
int x = i;
while((j > 0) && (array[x] < array[x - 1]))
{
swap(array[x], array [x - 1]);
x--;
}
}
its says : illegal structure
thanks
Whats wrong?
void sort()
{
int z, i;
for(i = 1; i <= z - 1; i++)
{
int x = i;
while((j > 0) && (array[x] < array[x - 1]))
{
swap(array[x], array [x - 1]);
x--;
}
}
its says : illegal structure
thanks
This
swap(array[x], array [x - 1]);
Should be?
swap( &array[x], &array[x-1] );
Hard to say without more code
no joy with that, caused heaps more errors, can I mail the code, I cannot post it I'm afraid.
thanks for the help
why be afraid? noone will steal your code, insertion sort algorithms are widly avaiable over the net...and all I think we'd need to look at is your struct declaration...but like Salem said, it's hard to tell without more code.