C语言结构体和联合体

1、单链表插入

#include <stdio.h>

#include <stdlib.h>



#define FALSE 0

#define TRUE 1

typedef struct NODE{

    STRUCT NODE *link;

    int value;

}Node;



int sll_insert(Node *current,int newvalue)

{

    Node *previous;

    Node *new;

    

    while(current->value<newvalue){

        previous =current;

        current =current->link;            

    }

    new =(Node *)malloc(sizeof(Node));

    if( new == NULL)

    return FALSE;

    

    new->value=newvalue;        

    new->link = current;

    previous ->link=new;

    return TRUE;

    

}



int main()

{

    int result;

    result=sll_insert(root,12);

    

    return 0;

}
待测--未调通

 

你可能感兴趣的:(C语言)