Top "Struct" questions

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

self referential struct definition?

I haven't been writing C for very long, and so I'm not sure about how I should go about doing …

c recursion struct typedef
forward declaration of a struct in C?

#include <stdio.h> struct context; struct funcptrs{ void (*func0)(context *ctx); void (*func1)(void); }; struct context{ funcptrs fps; }; …

c struct declaration forward
How to return a struct from a function in C++?

I've tried on a few different forums and can't seem to get a straight answer, how can I make this …

c++ function struct return structure
How do I find the size of a struct?

struct a { char *c; char b; }; What is sizeof(a)?

c struct sizeof
C - freeing structs

Let's say I have this struct typedef struct person{ char firstName[100], surName[51] } PERSON; and I am allocating space by malloc …

c struct malloc
Struct memory layout in C

I have a C# background. I am very much a newbie to a low-level language like C. In C#, struct's …

c struct memory-layout
C/C++ Struct vs Class

After finishing my C++ class it seemed to me the structs/classes are virtually identical except with a few minor …

c++ class struct
Should struct definitions go in .h or .c file?

I've seen both full definitions of structs in headers and just declarations—is there any advantage to one method over …

c header struct
Error: "Cannot modify the return value" c#

I'm using auto-implemented properties. I guess the fastest way to fix following is to declare my own backing variable? public …

c# variables struct immutability
How can I get the string representation of a struct?

For my application, it does not matter if the string is human readable or not.

string struct go