---
# System prepended metadata

title: CH3

---

# CH3
---
## **Stack**
:::info
**Array**
```C++
#include<stdio.h>
int maxsize=8;
int stack[8];
int top=-1;

int isempty(){
    if (top==-1)
        return 1;
    else
        return 0;
        
}

int isfull(){
    if (top==maxsize)
        return 1;
    else 
        return 0;
}

int pop(int n){
    if(!isEmpty()){
        data=stack[top];
        top=top-1;
        return data;
    }
    else{
        printf('Stack為空')
    }
}

int push(int data){
    if (!isFull()){
        top=top+1;
        stack[top]=data;
    }
    else{
        printf('Stack已滿')
    }
    
}
```

**Link List**
```clike=

Stuct Node{
    int Data;
    Node Next;
}
Stuct Stack{
    
}
bool isEmpty(){
    Node *top;

}
```
:::

---
## **Queue**
:::info
**Array**
```

```

**Link List**
```

```
:::

