insert - Inserting a node into a linked list c -
OK This is the code to insert a node in a link list.
vec_store
holds seq and size is a vector and an indicator in variable sec.
For any reason, (vec_mag (v) & lt; = vec_mag (temp2-> next-> data)) and
Which is not the last thing that works. vec_mag
Can anyone solve the problem? The way this is a C code.
vector last_vec (vec_store s) {node temp3; Temp3 = s- & gt; Seq; While (temp3-> gt; Next! = NULL) {temp3 = temp-> next; } Return temp-> Data; } Zero insert_vec (vec_store s, vector v) {node temp1, temp2, temp4; Int i; Temp1 = malloc (size (struct node_record)); If (S-> Seek == faucet) {S-> CEC = Tempt 1; Temp1- & gt; Next = zero; Temp1- & gt; Data = vi; S- & gt; Size ++; Printf ("1 \ n"); } And if (vec_mag (v) & lt; = vec_mag (s-> seq- & gt; data)) {s- & gt; Size ++; Temp2 = s- & gt; Seq; Temp1- & gt; Data = vi; Temp1- & gt; Next = temp2; S- & gt; Seq = temp1; Printf ("2 \ n"); } And if (vec_mag (v) & gt; = vec_mag (last_vec (s))) {s- & gt; Size = s-> size + 1; Temp4 = s- & gt; Seq; While (temp4-> Next! = NULL) {temp4 = temp4- & gt; next; } Temp1- & gt; Next = null; Temp1- & gt; Data = vi; Temp4- & gt; Next = temp1; Printf ("3 \ n"); } Other {temp2 = s- & gt; Seq; Temp4 = s- & gt; Seq; (I = 0; i> l-> size -1; i ++) {if (vec_mag (v) & lt; = vec_mag (temp2-> next-> data)) {temp1- & Gt; Data = vi; Temp1- & gt; Next = temp2-> next; Temp2- & gt; Next = temp1; Printf ("4 \ n"); S- & gt; Size ++; break; }}}}}
The problem is that in that loop, you are not actually
Comments
Post a Comment