Top "Struct" questions

A keyword in various programming languages whose syntax is similar to or derived from C (C++, C#, Swift, Go, Rust, etc.

How to initialize a struct in accordance with C programming language standards

I want to initialize a struct element, split in declaration and initialization. This is what I have: typedef struct MY_…

c struct initialization
typedef struct vs struct definitions

I'm a beginner in C programming, but I was wondering what's the difference between using typedef when defining a structure …

c struct typedef
Struct Constructor in C++?

Can a struct have a constructor in C++? I have been trying to solve this problem but I am not …

c++ struct constructor
C-like structures in Python

Is there a way to conveniently define a C-like structure in Python? I'm tired of writing stuff like: class MyStruct(): …

python struct
Difference between 'struct' and 'typedef struct' in C++?

In C++, is there any difference between: struct Foo { ... }; and: typedef struct { ... } Foo;

c++ struct typedef
Why should we typedef a struct so often in C?

I have seen many programs consisting of structures like the one below typedef struct { int i; char k; } elem; elem …

c struct typedef
How do you make an array of structs in C?

I'm trying to make an array of structs where each struct represents a celestial body. I don't have that much …

c arrays struct
When should you use a class vs a struct in C++?

In what scenarios is it better to use a struct vs a class in C++?

c++ oop class struct ooad
Difference between a Structure and a Union

Is there any good example to give the difference between a struct and a union? Basically I know that struct …

c struct unions