728x90
반응형
#include <stdio.h>
typedef struct _node
{
int data;
struct _node* next;
}Node;
typedef struct _list
{
Node* head;
Node* curr;
Node* before;
int number;
}List;
void Init(List* copy)
{
copy->head = (Node*)malloc(sizeof(Node));
copy->head->next = NULL;
copy->number = 0;
}
void Insert(List* copy, int data)
{
Node* newNode = (Node*)malloc(sizeof(Node));
newNode->data = data;
newNode->next = copy->head->next;
copy->head->next = newNode;
(copy->number)++;
}
int Count(List* copy)
{
return copy->number;
}
int main(void)
{
List list;
int data;
Init(&list);
Insert(&list, 10);
Insert(&list, 20);
Insert(&list, 30);
printf("Current Number of Data : %d\n", Count(&list));
return 0;
}
728x90
반응형
'Data Structure & Algorithm' 카테고리의 다른 글
other bill (0) | 2022.10.19 |
---|---|
Basic (0) | 2022.10.19 |
[Py] sequetial sideway move 1block (0) | 2022.10.18 |
[Python]Move to sidways Strings (0) | 2022.10.18 |
Linked List(+dummy) (0) | 2022.09.19 |