Home : Software Terms : Struct Definition

Struct

A struct (short for structure) is a data type available in C programming languages, such as C, C++, and C#. It is a user-defined data type that can store multiple related items. A struct variable is similar to a database record since it may contain multiple data types related to a single entity.

Below is an example of an article defined as a struct in the C programming language.

struct Article
{
    int    articleID;
    char   title[120];
    char   date[10];
    char   author[60];
    char   content[4000];
}

The above struct "Article" contains both integer and character array data types. It can be used to store all the information about an article in a single variable. Since structs group the data into a contiguous block of memory, only a single pointer is needed to access all the data of a specific article.

Structs are similar to classes used in object oriented programing languages, such as Objective C and C#. The primary difference between the two data structures is that structs are public while classes are private by default. That means struct variables can be accessed and modified by any function within the code, while classes may only be accessed by the function in which they are defined.

Updated: November 21, 2015

Cite this definition:

https://techterms.com/definition/struct

TechTerms - The Tech Terms Computer Dictionary

This page contains a technical definiton of Struct. It explains in computing terminology what Struct means and is one of many software terms in the TechTerms dictionary.

All definitions on the TechTerms website are written to be technically accurate but also easy to understand. If you find this Struct definition to be helpful, you can reference it using the citation links above. If you think a term should be updated or added to the TechTerms dictionary, please email TechTerms!