Top "Struct" questions

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

Define a struct inside a class in C++

Can someone give me an example about how to define a new type of struct in a class in C++. …

c++ class struct
How to convert a structure to a byte array in C#?

How do I convert a structure to a byte array in C#? I have defined a structure like this: public …

c# struct
Overloading operators in typedef structs (c++)

I want to make a typedef struct called pos (from position) that stores coordinates x and y. I am trying …

c++ struct typedef operator-keyword
C++, how to declare a struct in a header file

I've been trying to include a structure called "student" in a student.h file, but I'm not quite sure how …

c++ struct include header header-files
Convenient C++ struct initialisation

I'm trying to find a convenient way to initialise 'pod' C++ structs. Now, consider the following struct: struct FooBar { int …

c++ struct initialization
How to search for an element in a golang slice

I have a slice of structs. type Config struct { Key string Value string } // I form a slice of the above …

go struct slice
No == operator found while comparing structs in C++

Comparing two instances of the following struct, I receive an error: struct MyStruct1 { MyStruct1(const MyStruct2 &_my_struct_2, const …

c++ struct comparison-operators
Init array of structs in Go

I'm newbie in Go. This issue is driving me nuts. How do you init array of structs in Go? type …

arrays struct go
Why can't I define a default constructor for a struct in .NET?

In .NET, a value type (C# struct) can't have a constructor with no parameters. According to this post this is …

c# .net struct
Invalid application of sizeof to incomplete type with a struct

I have a struct where I put all the information about the players. That's my struct: struct player{ int startingCapital; …

c struct calloc