#include <stdio.h>
#include <stdlib.h>
typedef struct node {
    int sID;
    struct node *next; } Node;
Node *findLast (Node *start){  //연결리스트의 마지막 노드 주소 반환
    Node *p;
    if(start == NULL)
        return NULL;
        p=ㄱ;
    while(p->next != NULL){
        printf("findLast : %d\n", p->sID);
        p=p->next;
    }
    return p;
}

void insert(Node *start, int s){ 
//연결리스트의 마지막 노드 다음에 새로운 학생의 학번이 저장된 노드를 추가하는 함수
    Node *n, *p;
    p=findLast(start);
    if (p != NULL){
        printf("insert : %d \n", p->sID);
        n=(Node *) malloc (sizeof(Node));
        n->sID=s;
        n->next=NULL;
        ㄴ=n;
    }
}
int main(){
    Node *start=NULL;
    start = (Node*)malloc (sizeof(Node));
    start->sID=10000;
    start->next=NULL;
    insert(start, 20000);
    insert(start, 30000);
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: