Skip to main content
struct

struct

1 7.6
A group of related pieces of data kept together under one name in a program
  • noun
  • /strʌkt/
  • Specialized
translation icon : estructura de datos
  • I wrote some code in which I created 3 structs, all with the same members, with packing set to 1, normal alignment, and with the members rearranged.

We can write C++ kind of code with structs if you want.

Examples

  • In C, structs are based on pointers, so you need to use the -> like Keith said.

    Blog text (16)
  • Notice that I put this struct inside this struct.

  • So this will actually pad the struct a little bit at the end.

  • The next field of this struct is just going to be null.

  • So first we have this struct on the left thread args.

  • I decided to use a linked list to implement the Queue class, meaning that I need to use my own Node struct.

    Blog text (23)
  • Certainly, I understand the implications on the size of the class/struct in terms of padding.

    Blog text (18)
  • From what I understand, you seek through the file until you get to the part you want to edit, then extract it into memory as a struct, edit it, and then output it back to the same spot in the file.

    Blog text (10)
  • Either you need to modify your struct definitions not to contain pointers, or you need to parse the received data and fill the struct field by field.

    Blog text (5)
  • In programming, a struct can be used to organize related data, such as a person's name and age.

Synonyms

data structure
vsstruct
  • Specialized
4 3.9

A way to store and organize data in a computer so programs can use it quickly

refers to a specific programming grouping that bundles related variables under one name

How Complex

module
101 3.7
class
1.8
object
  • Specialized
52 6.9
struct
  • Specialized
1 7.6
to array
16 3.9
variable
  • Specialized
140 4.2

Surface Forms

struct singular
structs plural

Etymology

Struct comes from the Latin root struere meaning 'to build', and it shares this root with words like structure and construct. A helpful way to remember the programming struct is to imagine a small 'built' box that holds different pieces of data together, so it groups related information.