1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdio.h>
struct _stack
{
    int data;
    struct _stack * next;
}typedef Stack;
 
Stack* push(Stack* stack,int data)
{
    Stack* newstack;
    newstack = (Stack*)malloc(sizeof(Stack*));
    newstack->data = data;
    newstack->next = stack;
    stack= newstack;
    return stack;
}
 
Stack* pop(Stack* stack)
{
    Stack* rstack;
    rstack = stack;
    printf("삭제된 데이터 : %d\n"stack->data);
    rstack = rstack->next;
    stack = rstack;
    return rstack;
}
 
int main()
{
    Stack* stack;
    Stack* curr;
    int data;
    stack=push(NULL3);
    stack=push(stack5);
    stack=push(stack10);
    stack=pop(stack);
}
cs


이건 스택이아니라 스택으로 이름바꾼 연결리스트같지?