fixed bugs

This commit is contained in:
Rakshaa Viswanathan
2020-09-01 11:03:56 +05:30
committed by GitHub
parent 883e3447d4
commit d0e1f715f6

View File

@@ -41,16 +41,16 @@ nodes as 40, 60 and 30.
struct Node{
int data;
Node *next;
Node(int x){
explicit Node(int x){
data=x;
next=NULL;
next=nullptr;
}
} *head;
//To search for the given node
Node *findNode(Node *head, int search){
Node *cur= head;
while(cur!=NULL){
while(cur!=nullptr){
if(cur->data==search)
break;
cur=cur->next;
@@ -59,7 +59,7 @@ Node *findNode(Node *head, int search){
//To populate the linked list
void insert(){
int i, n, value;
int i=0, n, value;
Node *temp;
scanf("%d",&n);
for(int i=0; i<n; i++){
@@ -97,7 +97,7 @@ void deleteNode(Node *m)
//Main function
int main(){
int k, n, val;
int k;
insert();
scanf("%d",&k);
Node *del= findNode(head,k);