Category "struct"

ConfigureAwait(false) and struct implementation of IAsyncDisposable

I have implemented IAsyncDisposable with an ActionOnAsyncDispose struct as shown below. My understanding is that the compiler will not box it when it is in an a

I'm trying to create a stack in c using structures but my push function doesn't work

I'm trying to create a stack in C using structures but the push() function I wrote is acting strangely. I'm sure it is something obvious that I'm missing but I

How do I avoid printing the first node in my linked list?

I'm trying to create a linked list that has 2 data types and a function that inserts nodes. But in order to insert nodes, I have to create at least 1 empty node

Pyspark: Write CSV from JSON file with struct column

I'm reading a .json file that contains the structure below, and I need to generate a csv with this data in column form, I know that I can't directly write an ar

How to flatten a nested Json struct using Python databricks

Trying to flatten a nested json response using Python databricks dataframe. I was able to flatten the "survey" struct successfully but getting errors when i try

Can't Print array with multiple data types

I created a struct named products that contains multiple data types: struct products{ int ID; string Name; double Price; int Quantity; }; Then

Generic Structs with Go

What is the equivalent of this C# code in Go, how can I build it class ModelX<T> { public T Data { get; set; } } ModelX<int>

Brace Initialize struct with virtual functions

Brace initialization struct A { int a; int b; void foo(){} }; A a{1, 2}; It works fine. Bu

stack smashing detected when trying to get to typedef two dinatial array that the adress store inside struct

i have this typedef of two dinantial array, and strust the keep his adress typedef double mat[MAT_SIZE][MAT_SIZE]; typedef struct matList { char *name;

SwiftUI - Generating Picker options from Multi-Level Struct (created from JSON)

I'm struggling to populate Picker on SwiftUI from Multi-Level Struct that is generated from a JSON data source. The struct has the following format struct DataS

C, Do structs with multiple dynamically allocated arrays need to be resized for every allocation?

Below I have a struct with multiple dynamically allocated char arrays. It compiles, Valgrind indicates no issues and it functions as anticipated. Earlier, someo

Does adding a star after a pointer struct definition make it a double pointer?

I have a struct typedef struct hash_entry_{ char *string; void *data; struct hash_entry *next; }hash_entry, *p_entry; I am referencing p_entry later i

Is there a way to use the #define directive to create a constant struct?

Let's say I have this struct typedef struct { int AM; char* name, surname; }Item; and I want to define a constant NULLitem with AM = -1 and NULL name/

How to I get my program to skip the uint32_t, then start reading the rest of the binary data into structs in C?

I have included my code below. I have it reading and printing the first line of a binary file. The rest of the file is meant to be put in a struct that contains

Pyspark create schema for maptype with different value types

I need to give the correct schema to an rdd I have, but struggling with a maptype that has different valuetypes. I guess the problem is that one specific Key ha

Returning dynamic memory inside a struct in C

Hi I have the following struct typedef struct mystruct_s { int* array; } mystruct; and I want to create a function that initializes it. I have two ways of

struct in union nested - understanding behaviour of type punning

The following code uses a structure inside a union inside a structure inside a union. #include <cstdio> union { char abcd[4]; struct {

Solidity mapping not returns an array in a struct

The Solidity's mapping not returns an array inside a struct (when call mapping_data(), the data variable is undefined). Just be able to read it from read() func

How to initialize a struct to 0 in C++

Here is a related C answer that doesn't work (as a zero initializer for a struct) in C++: Initializing a struct to 0. One of the solutions presented is this: my

Cannot Read struct with string from PLC using s7netplus c#

im trying to read this data block from Siemens S1500 PLC using s7netplus libary and my mapped code struct looks like this public struct testStruct {