IronWater
IronWater

Reputation: 1

C:[error]linked list quicksort

I was writing the linked list quick sort.

void quick(NODE low,NODE High){
NODE stan=low, serch=NULL;
int pivot,temp

if(low==end || low -> Next =high || low == high){return;}

serch=stan -> Next;
pivot= stan -> data;

while(serch != high){
    if(serch -> data <= pivot){
        if(serch != pivot){
            temp= serch -> data;
            serch -> data =stan -> next ->data; 
            stan -> next ->data=temp;
        }
        stan = stan -> Next;
    }
}   
quick(low, stan);

quick(stan -> next,end);
}

but

[Error] invalid initializer

[Error] expected '=', ',', ';', 'asm' or 'attribute' before 'if'

[Error] invalid type argument of '->' (have 'NODE')

[Error] invalid type argument of '->' (have 'NODE')

[Error] 'high' undeclared (first use in this function)

[Note] each undeclared identifier is reported only once for each function it appears in [Error] invalid type argument of '->' (have 'NODE')

[Error] invalid operands to binary != (have 'NODE' and 'int')

[Error] 'temp' undeclared (first use in this function)

[Error] invalid type argument of '->' (have 'NODE')

[Error] invalid type argument of '->' (have 'NODE')

[Error] invalid type argument of '->' (have 'NODE')

[Error] invalid type argument of '->' (have 'NODE')

[Error] invalid type argument of '->' (have 'NODE')

[Error] invalid type argument of '->' (have 'NODE')

[Error] incompatible type for argument 2 of 'quick'

[Note] expected 'NODE' but argument is of type 'struct NODE *'

error why?

Upvotes: 0

Views: 99

Answers (1)

Selenium
Selenium

Reputation: 55

1.you miss ; after int pivot,temp
2.low -> Next =highshould be low -> Next ==high you should use ==,
3.your parameter is High void quick(NODE low,NODE High), but you use high,you should change
4.i guess NODE's type is struct ,you should use NODE.parameter,and if you want to use ->,you should use struct pointer ,so you need to define NODE *

Upvotes: 1

Related Questions