# irfankazitech/hospital-management-system-c architecture

> Architecture diagram of the GitHub repository irfankazitech/hospital-management-system-c, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/irfankazitech/hospital-management-system-c
- Repository: https://github.com/irfankazitech/hospital-management-system-c

## Overview

This is a single-file, menu-driven dispensary inventory program. The user selects an operation; the main loop displays the menu and dispatches to medicine add, display, search, sale, deletion, or low-stock alert logic. Those operations read or modify a shared in-memory stock array and interact directly with the console. The README documents these capabilities and the 100-record, non-persistent limit; the supplied source confirms their implementation.

Main entry points: [`dispensary.c`](https://github.com/irfankazitech/hospital-management-system-c/blob/main/dispensary.c) (Menu loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Menu interaction"]
  node_main["Menu loop<br/>[dispensary.c]"]
  node_show_menu["Show menu<br/>[dispensary.c]"]
end

subgraph group_operations["Inventory operations"]
  node_add["Add medicine<br/>[dispensary.c]"]
  node_display["Display stock<br/>[dispensary.c]"]
  node_search["Search medicine<br/>[dispensary.c]"]
  node_sell["Sell medicine<br/>[dispensary.c]"]
  node_delete["Delete medicine<br/>[dispensary.c]"]
  node_low_stock["Low-stock alert<br/>[dispensary.c]"]
end

subgraph group_state["In-memory state"]
  node_stock[("Medicine stock<br/>[dispensary.c]")]
end

node_user(("User"))
node_console["Console"]

node_user -->|"chooses option"| node_main
node_main -->|"calls"| node_show_menu
node_show_menu -->|"prints menu"| node_console
node_main -->|"reads choice"| node_console
node_main -->|"dispatches"| node_add
node_main -->|"dispatches"| node_display
node_main -->|"dispatches"| node_search
node_main -->|"dispatches"| node_sell
node_main -->|"dispatches"| node_delete
node_main -->|"dispatches"| node_low_stock
node_add -->|"reads and prints"| node_console
node_display -->|"prints stock"| node_console
node_search -->|"reads and prints"| node_console
node_sell -->|"reads and prints"| node_console
node_delete -->|"reads and prints"| node_console
node_low_stock -->|"reads and prints"| node_console
node_add -->|"appends record"| node_stock
node_display -->|"reads records"| node_stock
node_search -->|"searches records"| node_stock
node_sell -->|"reads and updates"| node_stock
node_delete -->|"removes record"| node_stock
node_low_stock -->|"checks quantities"| node_stock

click node_main "https://github.com/irfankazitech/hospital-management-system-c/blob/main/dispensary.c"
click node_show_menu "https://github.com/irfankazitech/hospital-management-system-c/blob/main/dispensary.c"
click node_add "https://github.com/irfankazitech/hospital-management-system-c/blob/main/dispensary.c"
click node_display "https://github.com/irfankazitech/hospital-management-system-c/blob/main/dispensary.c"
click node_search "https://github.com/irfankazitech/hospital-management-system-c/blob/main/dispensary.c"
click node_sell "https://github.com/irfankazitech/hospital-management-system-c/blob/main/dispensary.c"
click node_delete "https://github.com/irfankazitech/hospital-management-system-c/blob/main/dispensary.c"
click node_low_stock "https://github.com/irfankazitech/hospital-management-system-c/blob/main/dispensary.c"
click node_stock "https://github.com/irfankazitech/hospital-management-system-c/blob/main/dispensary.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_show_menu,node_user toneBlue
class node_add,node_display,node_search,node_sell,node_delete,node_low_stock toneAmber
class node_stock toneMint
class node_console toneIndigo
```

## Components

### Menu interaction

- [Menu loop](https://github.com/irfankazitech/hospital-management-system-c/blob/main/dispensary.c): `dispensary.c`
- [Show menu](https://github.com/irfankazitech/hospital-management-system-c/blob/main/dispensary.c): `dispensary.c`

### Inventory operations

- [Add medicine](https://github.com/irfankazitech/hospital-management-system-c/blob/main/dispensary.c): `dispensary.c`
- [Display stock](https://github.com/irfankazitech/hospital-management-system-c/blob/main/dispensary.c): `dispensary.c`
- [Search medicine](https://github.com/irfankazitech/hospital-management-system-c/blob/main/dispensary.c): `dispensary.c`
- [Sell medicine](https://github.com/irfankazitech/hospital-management-system-c/blob/main/dispensary.c): `dispensary.c`
- [Delete medicine](https://github.com/irfankazitech/hospital-management-system-c/blob/main/dispensary.c): `dispensary.c`
- [Low-stock alert](https://github.com/irfankazitech/hospital-management-system-c/blob/main/dispensary.c): `dispensary.c`

### In-memory state

- [Medicine stock](https://github.com/irfankazitech/hospital-management-system-c/blob/main/dispensary.c): `dispensary.c`

### Other components

- **User**
- **Console**

## Connections

- User → Menu loop: chooses option
- Menu loop → Show menu: calls
- Show menu → Console: prints menu
- Menu loop → Console: reads choice
- Menu loop → Add medicine: dispatches
- Menu loop → Display stock: dispatches
- Menu loop → Search medicine: dispatches
- Menu loop → Sell medicine: dispatches
- Menu loop → Delete medicine: dispatches
- Menu loop → Low-stock alert: dispatches
- Add medicine → Console: reads and prints
- Display stock → Console: prints stock
- Search medicine → Console: reads and prints
- Sell medicine → Console: reads and prints
- Delete medicine → Console: reads and prints
- Low-stock alert → Console: reads and prints
- Add medicine → Medicine stock: appends record
- Display stock → Medicine stock: reads records
- Search medicine → Medicine stock: searches records
- Sell medicine → Medicine stock: reads and updates
- Delete medicine → Medicine stock: removes record
- Low-stock alert → Medicine stock: checks quantities
