diff --git a/Circular Linked List.c b/Circular Linked List.c index 485048c..1b2116f 100644 --- a/Circular Linked List.c +++ b/Circular Linked List.c @@ -182,7 +182,7 @@ void insertmid() { int i; temp=head; - for(i=0;inext; } @@ -279,7 +279,7 @@ void search() flag=1; } temp=temp->next; - i++; + i+1; }while(temp!=head); if(flag!=1) { @@ -300,7 +300,7 @@ void count() do { temp=temp->next; - i++; + i+1; }while(temp!=head); printf("\nCircular Linked List Contains %d Nodes\n",i); } diff --git a/Linked List.c b/Linked List.c index dc4e1e5..55d42ac 100644 --- a/Linked List.c +++ b/Linked List.c @@ -21,6 +21,7 @@ int main() Node *head=NULL; init(&head); int c; + //choices while(1) { printf("1.Insert\n2.Delete\n3.Display\n4.Count Number of Nodes\n5.Search Element\n6.Exit\nEnter a Choice : "); @@ -93,7 +94,7 @@ void init(Node **p) { int i; Node *newnode; - for(i=0;iinfo=data; newnode->next=NULL; - for(i=0;inext; newnode->next=temp->next; temp->next=newnode; @@ -231,7 +232,7 @@ void search(Node **p) flag=1; printf("Found at %d\n",i); } - i++; + i+1; } if(flag==0) printf("\nNot Found\n");