首页 > 代码库 > C语言结构体和联合体

C语言结构体和联合体

1、单链表插入

#include <stdio.h>#include <stdlib.h>#define FALSE 0#define TRUE 1typedef 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=http://www.mamicode.com/newvalue;            new->link = current;    previous ->link=new;    return TRUE;    }int main(){    int result;    result=sll_insert(root,12);        return 0;}
待测--未调通

 

C语言结构体和联合体