# Include <stdio. h> # Include <Stdlib. h> # Define Maxlength 1000 Struct Linknode { Int Date; Struct Linknode * Link;}; typedef Struct Linknode; linknode * Createlinknode (){ Int I; linknode * Node, * P ,*_ Temp; Node = (Linknode *) malloc ( Sizeof (Linknode )); If (! Node) {printf ( " Memory Allocation failed " ); Exit ( 1 );} Puts ( " Enter a value " ); Scanf ( " % D " , & Node-> Date); Node -> Link = NULL; _ temp = Node; For (I = 1 ; I < 3 ; I ++ ) {P = (Linknode *) malloc ( Sizeof (Linknode )); If (! P) {puts ( " Memory Allocation failed " ); Exit ( 1 );} Puts ( " Enter a value " ); Scanf ( " % D " , & P-> Date); P -> Link = NULL; _ temp -> Link =P; _ temp = _ Temp-> Link ;} Return Node;} linknode * Findnode (linknode * head, Int Num) {linknode * P = Head; While (P ){ If (P-> date = num) Return P; P = P-> Link ;} Return P ;} Void Shownode (linknode * P ){ While (P! = Null) {printf ( " % D \ t " , P-> Date); P = P-> Link ;}} Void Insertnode (linknode * P, Int Val) {linknode * Newnode = (linknode *) malloc ( Sizeof (Linknode); newnode -> Date = Val; newnode -> Link = NULL; If (P-> link = NULL) P-> link = Newnode; Else {Newnode -> Link = p-> Link; P -> Link = Newnode ;} Return ;} Void Deletenode (linknode * head, linknode * P) {linknode * _ Temp; If (P-> link! = Null) {_ temp = Head; While (_ Temp-> link! = Null ){ If (_ Temp-> link = P) {_ temp -> Link = p-> Link; Break ;} _ Temp = _ Temp-> Link ;}} free (P ); Return ;} Void Freenode (linknode * Head) {linknode * PTR; While (Head! = Null) {PTR = Head; head = Head-> Link; free (PTR );}} Void Main (){ Int Sear, sear1; linknode * Newhead ,* PTR; newhead = Createlinknode (); shownode (newhead); printf ( " Enter the value to be searched " ); Scanf ( " % D " ,& SEAR); PTR = Findnode (newhead, sear ); If (! PTR) {printf ( " No value found " );} Else {Puts ( " Enter the data to insert " ); Scanf ( " % D " ,& SEAR); insertnode (PTR, sear); shownode (newhead);} puts ( " Enter the data to be searched and deleted " ); Scanf ( " % D " ,& Sear1); PTR = Findnode (newhead, sear1 ); If (! PTR) {puts ( " This value is not found " );} Else {Deletenode (newhead, PTR); shownode (newhead );}}