How to code memory diagram??

I was asked to code this memory diagram: I was also given this struct: struct product { char *name; dou...

How to initialize an array of struct in C++??

I have the following struct in my C++ code (I am using Visual Studio 2010): struct mydata { string scientist; ...

how to make a function body repeat in c?

So I am making this program and I am almost done. However, before I finish I need to make a body function repeat n t...

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++. Thanks. ...

How to cast interface {} to struct?

I was looking for how to cast the interface to a struct, but I do not how I can not do it. I will try to explain my...

Error: incomplete type is not allowed?

in .h: typedef struct token_t TOKEN; in .c: #include "token.h" struct token_t { char* start; int length...

forward declaration of a struct in C??

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

c pointer to array of structs?

I know this question has been asked a lot, but I'm still unclear how to access the structs. I want to make a global...

Initialize values of array in a struct?

I have a struct which has several arrays within it. The arrays have type unsigned char[4]. I can initialize each el...

Struct Constructor in C++??

Can a struct have a constructor in C++? I have been trying to solve this problem but I am not getting the syntax. ...

What is the cause of flexible array member not at end of struct error??

I am wondering why I keep getting error: flexible array member not at end of struct error when I call malloc. I have...

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 uses all...

Are there any drawbacks to using multiple arrow operators (->) chained together??

Suppose we have some structured data that is encapsulated in another structure so that a circular linked list can be...

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 experi...