> For the complete documentation index, see [llms.txt](https://cui-jiacai.gitbook.io/whale-market/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cui-jiacai.gitbook.io/whale-market/da-jian-shu-ju-jie-gou.md).

# 搭建数据结构

在这个环节里面，我们会搭建本次project所需要的所有的数据结构。搭建步骤基本如下：

* 定义数据类型

  > 我选择用结构体来定义单体数据的类型。
* 选择数据结构

  > 我选择了数组作为储存单体数据的数据结构，当然，这样选择需要我们约定一下最大数据规模。这个约定将在后续内容中陈述。
* 设计对外接口

  > **裸露的数据结构是不可以直接给外部模块使用的**，这样在实际开发过程中会很危险。所以我们在定义数据结构的时候，需要隐藏内部实现，将可以进行的操作封装起来，以供外部模块调用。

## 我们需要实现的模块

```c
.---+- include -+- tools -+- color.h
    |           |         +- hint.h
    |           |         +- info.h
    |           | 
    |           +- user  -+- user.h <---
    |           |
    |           +- good  -+- good.h <---
    |           |
    |           +- order -+- order.h <---
    |           |
    |           +- config.h <---
    |
    +-   src   -+- tools -+- color.c
                |         +- hint.c
                |         +- info.c 
                |
                +- data  -+- id.txt
                |         +- user.txt <---
                |         +- good.txt <---
                |         +- order.txt <---
                |
                +- user  -+- user.c <---
                |
                +- good  -+- good.c <---
                |
                +- order -+- order.c <---
                |
                +- main.c
```

{% hint style="success" %}
至此，你应该对怎样编写一个数据结构模块有了初步的认识，下面让我们正式进入数据模块的搭建吧！
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cui-jiacai.gitbook.io/whale-market/da-jian-shu-ju-jie-gou.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
