mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-04-03 10:39:42 +08:00
fixed bugs
This commit is contained in:
committed by
GitHub
parent
883e3447d4
commit
d0e1f715f6
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user