# Declare custom structs

EOS.IO Asked by Jimmy Sullivan on August 20, 2021

I am trying to create a custom struct called Student in a contract. Where do I declare or define the struct? I tried to define it in the abi file, but the file was over written when I compile the contract.

struct Student {
uint id;
string content;
bool present;
}

In traditional development defining structs depends a bit on the architecture of the software and certain conventions but I'll neglet this in this post.

To give you a simple eosio-sepcific answer:

1. You don't declare structs in the Abi yourself, the eosio.cdt generates the Abi for you and includes the types that are needed to be included. (There are some special cases where it makes sense to manipulate the generated abi but you shouldn't care about that)
2. You typically declare and define custom structs in one of your header-files (in your case you probably only have a single one).

Simply do:

    struct student_t {
uint id;
string content;
bool present;
}


somewhere at the top of your contractname.hpp (within or outside of the contract-class).

## Related Questions

### List of available datatypes for action parameter

4  Asked on January 16, 2021 by eclipse

### Is there a requirement to use the eosio.token account/contract for managing tokens?

1  Asked on January 8, 2021 by tommccann

### Does EOS support signing a string?

2  Asked on December 23, 2020

### Can we use mongodb store state?

1  Asked on November 28, 2020 by user2644

### EOSIO Tutorial: Development Public Key vs eosio development key

1  Asked on September 19, 2020 by gofly

### Profiling EOS.IO smart contract code

1  Asked on August 11, 2020 by yogev-mashiach