> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/hypersim/library-blocks-reference/control-miscellaneous/c-code.md).

# C Code

## Description

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-7446c9a7246e7f1f7b3c528902df9576c6595d1f%2Fimage%20(934).png?alt=media" alt="" width="148"><figcaption></figcaption></figure>

The **C** **code** block, located in the **Control Miscellaneous** library, lets you implement simple C code to compute outputs (y) from inputs (u).

## Mask parameters

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-c2fb17523cbb8cb92677ec7df4aca759d0d38da4%2Fimage%20(935).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

| Parameter             | Description                |
| --------------------- | -------------------------- |
| **Number of inputs**  | Maximum value 32           |
| **Number of outputs** | Maximum value 32           |
| **Parameters**        | Name and value type double |

{% hint style="info" %}
u1, u2, etc. are reserved for inputs y1, y2, etc. are used for outputs.
{% endhint %}

{% hint style="danger" %}
C code errors will only be detected during compilation. This block is intended for simple C code only.\
For more complex code, use the User-coded Model (UCM)
{% endhint %}

## Inputs

| Input | Description                                                                                     |
| ----- | ----------------------------------------------------------------------------------------------- |
| **u** | <p>Input named u, type double<br>Inputs are automatically created with the number of inputs</p> |

## Outputs

| Output | Description                                                                                        |
| ------ | -------------------------------------------------------------------------------------------------- |
| **y**  | <p>Output named y, type double<br>Outputs are automatically created with the number of outputs</p> |


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/hypersim/library-blocks-reference/control-miscellaneous/c-code.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
