Top "Struct" questions

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

What are the use(s) for tags in Go?

In the Go Language Specification, it mentions a brief overview of tags: A field declaration may be followed by an …

go struct reflection tags
Changing the value of an element in a list of structs

I have a list of structs and I want to change one element. For example : MyList.Add(new MyStruct("john"); …

c# struct value-type
How to set and get fields in struct's method

After creating a struct like this: type Foo struct { name string } func (f Foo) SetName(name string) { f.name = name } …

struct get set go
How to initialize member-struct in initializer list of C++ class?

I have the following class definitions in c++: struct Foo { int x; char array[24]; short* y; }; class Bar { Bar(); int …

c++ list constructor struct initializer
In Go, how can I convert a struct to a byte array?

I have an instance of a struct that I defined and I would like to convert it to an array …

arrays struct go byte
memset() or value initialization to zero out a struct?

In Win32 API programming it's typical to use C structs with multiple fields. Usually only a couple of them have …

c++ c visual-c++ struct initialization
How to compile C code with anonymous structs / unions?

I can do this in c++/g++: struct vec3 { union { struct { float x, y, z; }; float xyz[3]; }; }; Then, vec3 v; …

c++ c struct anonymous unions
Why are mutable structs “evil”?

Following the discussions here on SO I already read several times the remark that mutable structs are “evil” (like in …

c# struct immutability mutable
How do I concatenate two strings and store them into the same struct key

I'm using Coldfusion. I want to concatenate two strings into the same struct key, but I keep getting an error …

string coldfusion struct
Are there any downsides to passing structs by value in C, rather than passing a pointer?

Are there any downsides to passing structs by value in C, rather than passing a pointer? If the struct is …

c struct parameter-passing abi