Skip to main content
Filter by
Sorted by
Tagged with
9 votes
1 answer
535 views

Okay it probably doesn't. That would be weird. I'm guessing, I'm allocating my memory wrong somehow. #include <stdio.h> #include <stdlib.h> /*I have two Structs. In one there is a pointer ...
dedpunkrz's user avatar
  • 169
2 votes
1 answer
147 views

I am encountering a problem inside a while loop that is embedded in a for loop iterating through a struct of arrays. The issues I am coming across is before the array iterates again, I want to have ...
Zachary Vandermude's user avatar
-1 votes
3 answers
125 views

Given the following C struct: struct __attribute__((__packed__)) XIRControl { uint8_t command; char code[19]; uint16_t error; union codeData { struct rcvCommands { ...
Jon Anthony's user avatar
0 votes
0 answers
88 views

I'm making an assembly program that is supposed to get the mac address of the specified interface, however, when I try to assemble it, I get this error. gethwaddress.s:12: warning: multi-line macro `...
Virtual Wizard's user avatar
-2 votes
3 answers
218 views

Can I declare a variable along with a pointer? //like this struct node n1,n2,n3,*start; //or do i have to do it separately struct node *start;struct node n1,n2,n3; to declare variable alongside ...
Sandeep's user avatar
  • 39
2 votes
2 answers
199 views

I'm making it using multi inheritance with a pair struct that contains an index and the type of the element in a recursive structure like this: template<int index, typename... ts> struct ok; ...
thefentmaster5's user avatar
1 vote
0 answers
71 views

I'm naming a struct type with typedef, and I've been using them like this typedef struct { double x, y, z; } vect3; However I found out in other headers such as Win32, that it tends to be like ...
Sterticc's user avatar
4 votes
7 answers
280 views

I want to define an API function in header file, and then implement it in source file. Here is the hello.h, I want to define "world" in header: typedef struct Hello { int (*world) (void);...
stackbiz's user avatar
  • 1,914
-1 votes
0 answers
149 views

I am making a card game and im now revamping how individual card information is stored. a single card would have the following values: x, y, suit, number, state this is to be stored in a deck array ...
Mounif Alzougbi's user avatar
0 votes
6 answers
276 views

I'm working (in C) with a struct that contains arrays of strings. How do I point to one of those strings? To make it a bit clearer, consider: struct Books { char title[MAX1][MAX2]; char author[MAX1][...
dehulst's user avatar
  • 69
3 votes
2 answers
170 views

The code below looks crazy, because I am interested in finding out the limits of what’s possible, and it isn’t exactly what I’m doing in my real code. It compiles without warnings and works as ...
njlarsson's user avatar
  • 2,540
-1 votes
0 answers
96 views

I’ve been working with C# for 4 months. I’ve gained some experience, good and bad. Lately, I wanted to focus more on the concept of objects. There’s a very important point that has been bothering me. ...
Ekin King Ekin's user avatar
3 votes
1 answer
117 views

I have the following code in Odin: Foo :: struct { x: int, y: int, } a := Foo{1, 1} b := Foo{1, 1} #assert(a == b) According to official documentation I would expect to be able to compare ...
Slava.In's user avatar
  • 1,195
-2 votes
1 answer
64 views

I want to create structures in SMT-LIB, like structs in C. So I coded this: (set-option :print-success false) (set-logic HO_ALL) (declare-datatype |struct(Note : Z, Suffisant : BOOL)| (|record struct(...
Wissem Flitti's user avatar
-5 votes
2 answers
176 views

I'm writing a program that is very sensitive to garbage collection so I'm trying to avoid allocating to the heap after initialization. In the example below, calling Run() will allocate to the heap ...
ATD's user avatar
  • 892
-2 votes
2 answers
136 views

This was a question in a C Programming assignment given to me as a part of last week's assessment. Requesting everyone to kindly explain what needs to be done and how it needs to be done. Kindly note ...
Gargi Chaturvedi's user avatar
-3 votes
1 answer
73 views

I have code analogous to the following: struct A(String); impl A { fn new(&str) -> Self ... } struct B(String); impl B { fn new(&str) -> Self ... } struct C(String); ...
lilHar's user avatar
  • 1,883
1 vote
1 answer
110 views

I have a table named tasks where have relationship one-many to another table (projects), i want to query tasks with projects but only return selected column from the projects table. how i can do that ...
user avatar
10 votes
1 answer
907 views

During coding of std::atomic, CAS, etc, I always struggle to memorize the definition of CPP class being "TriviallyCopyable". Now I am gradually switching to C world, I accidentally found ...
PkDrew's user avatar
  • 2,301
4 votes
2 answers
138 views

I have a struct which holds some pointers to data it does not own, e.g.: struct s { int* x; int* y; }; I can then pass it as a const pointer itself: int foo(const struct s* s) { return *s-...
Dominik Kaszewski's user avatar
6 votes
2 answers
264 views

I have the following structure in my .c file. #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct Student { char* name; int age; int id; } Student; ...
iii's user avatar
  • 107
0 votes
2 answers
165 views

I want to create a parser in C++ for my programming language. Its logic is a little different than usual, because I want to first organize tokens in blocks (such as expressions or IDs, that are ...
varevind's user avatar
1 vote
1 answer
108 views

In the libc++ implementation of std::expected, there is this helper variable template: // This function returns whether the type `_Second` can be stuffed into the tail padding // of the `_First` type ...
TheAliceBaskerville's user avatar
1 vote
2 answers
147 views

In some languages, we can declare and initialize an anonymous struct - or the equivalent thereof - seamlessly. Example from ECMAScript: function foo_in_ecmascript(x) { let computed = { ...
einpoklum's user avatar
  • 138k
4 votes
1 answer
115 views

Prior statement: I'm a programmer long coding in C++ and Python, so kindly pardon and teach if my question looks too silly due to my thinking of C in an OOD way. Also I've tried lot searching on ...
PkDrew's user avatar
  • 2,301
15 votes
1 answer
916 views

I recently found out about [[no_unique_address]] attribute in C++. According to cppreference.com: Applies to the name being declared in the declaration of a non-static data member that is not a bit-...
TheAliceBaskerville's user avatar
2 votes
1 answer
180 views

I have defined a struct in another file called file1.h (example) and when I declare an array using that struct in another file called File2.h, i get the error Message: "Incomplete Type "...
Lemtay's user avatar
  • 23
0 votes
1 answer
111 views

It affects any struct. I've cleaned chars, renamed, tried new scripts – still fails. Any solutions? So frustrating. //@version=6 indicator("TestStruct", overlay=true) struct MyData float ...
Carlos Wittman's user avatar
1 vote
1 answer
157 views

I am currently building functions that take packets of CAN data and parse them into structs depending on their ID as seen below. Is there a 'cleaner' way of parsing data into structs instead of ...
C Flux's user avatar
  • 11
4 votes
1 answer
122 views

I'm writing a library for matrix and vector mathematics and I find it would be convenient to access vector components as if the vertex were both an array vector[2] and a struct vector.y, all while ...
bennett's user avatar
  • 63
0 votes
2 answers
126 views

I have a struct function which scans in coordinates, but when I call the function in my main function it doesn't seem to carry over any of the values and I get an error for 'use of undeclared ...
migoreng's user avatar
2 votes
1 answer
176 views

Suppose I have the following: struct S { char b[256]; }; struct S *buf = malloc(128); buf->b[0] = 1; You may notice that the allocation size is smaller than the structure size, but at no ...
CPlus's user avatar
  • 5,120
2 votes
2 answers
68 views

I have a non-scalar struct array. For example S=struct; S(1).f1='a'; S(2).f1='b'; How do I add a field .f2 to S for the same value 1 efficiently? such that S becomes a struct with S(1).f2=1; S(2).f2=...
Argyll's user avatar
  • 10.1k
1 vote
3 answers
127 views

I'm working on a project where I have a struct for which I want a default implementation. #[derive(Debug)] struct State { view_type: ViewType, booking_state: booking::State, calendar_state:...
Pioneer_11's user avatar
  • 1,451
0 votes
0 answers
61 views

In the following C++ code, three different structs are defined, each of which contains a pointer of each of other two structs. Intuitively, I would expect the output inside the function call and that ...
Yicun Zhen's user avatar
4 votes
1 answer
51 views

Problem Details: I'm developing a C contact management system where each contact is stored as: struct Contact { char name[31]; char number[11]; char email[30]; }; Current Behavior: When ...
Z4KI'S HERE's user avatar
1 vote
3 answers
116 views

How do I initialize an array of structs within a struct in C#? public const int MAX_AXIS = 10; struct realprm { /* real parameter */ long prm_val; /* value of variable */ long ...
cncmang's user avatar
  • 39
3 votes
1 answer
140 views

I am trying to understand how the sizeof operator works for C structures with bit-fields, particularly regarding packing and alignment. Below is a C program I wrote: #include <stdio.h> typedef ...
mauli02k's user avatar
2 votes
0 answers
68 views

Have a look at this short code (can be run as Program.cs): var a = new MyStruct(); public record struct MyStruct { public static HttpRequestOptionsKey<MyStruct> OptionKey = new(nameof(...
mnj's user avatar
  • 3,681
0 votes
0 answers
34 views

The struct below crashes sometimes, but sometimes not ! I have executed the code on SciNotes, it runs fine, but when I give command SmokestackData in the Scilab console, Scilab crashes but not always. ...
Petri Lahtinen's user avatar
4 votes
1 answer
158 views

#include <iostream> #include <string> #include <cassert> struct Foo { std::string bar = "standard"; int x = 1; int y = 1; bool operator==(const Foo&) const = ...
Jabberwocky's user avatar
  • 51.3k
2 votes
1 answer
251 views

I'm facing an issue when inserting records into struct field in Azure Databricks using SQL. In my INSERT INTO statement I have a condition based on which I want to insert either null or a struct. ...
cornisto's user avatar
  • 241
0 votes
1 answer
61 views

I need your help. I have a problem, is that I need to verify if an element inside a JSON (share_id), which is in turn inside an array, has a legth greater than 20. There maybe be more than one set of ...
Julio's user avatar
  • 543
0 votes
2 answers
71 views

I want to add a row number to a race list as shown above. Currently everyone is coming first. It's conditional as some people didn't finish (DNF). So first I set up an ObservableObject: class ...
Edward Hasted's user avatar
1 vote
1 answer
65 views

I wrote couple data types (struct) to store small arrays and copy them by values: Array4 { base: int16|short, purpose: to store up to 4 values } Array8 { base: int32|int, purpose: to store up to 8 ...
leofun01's user avatar
  • 341
1 vote
0 answers
82 views

I want to use std::set with a custom struct I've defined, similar to a question asked here. So in that case the struct needs an additional overload of the < operator to enable comparison. The ...
Bakefish's user avatar
  • 326
0 votes
1 answer
104 views

I am guessing the answer will eventually be "no, you can't do that", but trying to figure out how to do a thing in C#. I am wondering on a bit of glue code between two pieces that I do not ...
Nathan Weyer's user avatar
1 vote
3 answers
166 views

In Modern C by Jens Gustedt, I read that For historical reasons (again!), the name that we introduce for the structure always has to be preceded by the keyword struct, which makes its use a bit ...
Enlico's user avatar
  • 30.3k
0 votes
1 answer
149 views

I'm trying to write some UI-Code (for learning purposes) and I get this error that I can't find a fix to. The 4 errors are `E0493` No instance of overloaded function "UIElement::UIElement" ...
greifer500's user avatar
2 votes
2 answers
95 views

For optimization reasons, I'd like arrays in struct to be "nullable", so that I can allocate memory for it later. Like array parameters in functions. This means, I need an array inside a ...
ChrisoLosoph's user avatar

1
2 3 4 5
616