# add\_struc

define a new structure type index - index of new structure type If another structure has the specified index, then index of that structure and all other structures will be increment freeing the specified index. If index is == -1, then the biggest index number will be used. See [get\_first\_struc\_idx](/8.4/developer-guide/idc/idc-api-reference/alphabetical-list-of-idc-functions/371.md)() for the explanation of structure indices and IDs.

```
     name     - name of the new structure type.

     is_union - 0: structure
                1: union
```

returns: -1 if can't define structure type because of bad structure name: the name is ill-formed or is already used in the program. otherwise returns ID of the new structure type

long add\_struc(long index, string name, long is\_union);


---

# Agent Instructions: 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://docs.hex-rays.com/8.4/developer-guide/idc/idc-api-reference/alphabetical-list-of-idc-functions/393.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.
