Questions tagged [structure]

Structure is a fundamental, tangible or intangible notion referring to the recognition, observation, nature, and permanence of patterns and relationships of entities. DO NOT USE this tag for C or C++ struct questions!

A structure can be a:

  • A structure in mathematical logic: in universal algebra and in model theory, a structure consists of a set along with a collection of finitary operations and relations which are defined on it.

  • The structure of a program

For the following topics, use different tags as indicated below:

  • A : a particular way of storing and organizing data in a computer so that it can be used efficiently.
  • A (short for "structure") is a keyword in the C and C++ languages, used to indicate a structures record.
6561 questions
1
vote
1 answer

Why structure and its typedef consume different size when aligned?

I was expecting both sizes are 8 but i get sizeof(myStruct) = 16, sizeof(myType) = 8. I compiled this on Windows 64-bit machine with MinGW. #include #include struct s1{ int8_t a; int32_t b; }…
the_bugger
  • 35
  • 5
1
vote
1 answer

Create a program that sums the diagonal of a matrix

I'm trying to create a program that sums the diagonal of a matrix that I've created. I used the code below but I don't understand whats wrong with the code I made. a <- c(1, 2, 3) b <- c(3, 5, 6) x <- matrix(a, b, nrow=3, ncol=3) x for (i in…
1
vote
2 answers

Accessing values inside a structure in Berkeley DB using C

I want to have a integer value to my "key.data" in Berkeley DB. Since we use DBT structures in Berkley DB,and it has "A pointer to a byte string", I created a structure for key with a memeber int. But now I am facing problem in accessing the value…
user537670
  • 821
  • 6
  • 21
  • 42
1
vote
4 answers

Segmentation fault while storing values inside a strucure from other structure using C

I have two structures typedef struct profile_datagram_t { unsigned char *src; unsigned char *dst; unsigned char ver; unsigned char n; struct profile_t profiles[MAXPROFILES]; } header; header outObj; struct pearson_record { …
user537670
  • 821
  • 6
  • 21
  • 42
1
vote
2 answers

Defining API class in component based structure

I have been reading the 'Node JS Best Practices' Github article. One point that I I found interesting was the very first best practice. Here they split up the project structure based on components. One of the advises was to use functions and classes…
Stephen
  • 913
  • 3
  • 24
  • 50
1
vote
2 answers

huge zend framework project and where to place models

We have a huge Zend Framework project, it's basically a website in 4 different languages and with a fair amount of pages. Usually my application handle 10~15 database tables and probably 5/6 controllers so I place all my model under…
RageZ
  • 26,800
  • 12
  • 67
  • 76
1
vote
1 answer

C programming: Differences between structure initialization way

I have below code that works wifi_config_t wifi_config = { .sta = { .ssid = EXAMPLE_ESP_WIFI_SSID, .password = EXAMPLE_ESP_WIFI_PASS, .threshold.authmode = WIFI_AUTH_WPA2_PSK, .pmf_cfg = { .capable =…
Deddy
  • 13
  • 3
1
vote
2 answers

Structure variable has Pointer variable in c

I want to know why structure variable passes pointer variable to create memory. what happens if we do box *boxes = malloc(n * sizeof(box)); Then we pass address to scanf function. Pointer actually stores the address. Then why we pass "&" of scanf…
1
vote
0 answers

calling function within class structure producing bound method error

I'm trying to use this class to streamline EDA: class EDA: def __init__(self, df): self.df = df def initial_eda_checks(df): if df.isnull().sum().sum() > 0: mask_total =…
Jc Ong
  • 11
  • 1
1
vote
1 answer

Remove rows of multidimensional structures

I need to remove rows which represent dots of multidimensional structure, which are closest to each other. For example, if structure is: struct Point dot[100] = { {{1, 1, 1, 1}}, {{2, 2, 2, 2}}, {{1.3, 1.3, 1.3, 1.3}} }; After applying…
user17936920
1
vote
4 answers

Writing a database migrator in Java, Memory Issues (Code Structuring?)

I'm currently attemping to transfer data away from filemaker pro 11 to MySQL using JDBC. I've dealt with setting up the connection to each, and have queries that work, and insert the data safely into MySQL. try { results = …
Paul Sellars
  • 304
  • 1
  • 9
1
vote
1 answer

Reading custom (.ndev) Json-like file structure

I'm currently creating a custom file structure (File extension is .ndev), to increase my skill in working with files in C++. I can save values to a file in a specific way (See below) { "username": "Nikkie", "password": "test", "role":…
NikkieDev
  • 236
  • 3
  • 12
1
vote
1 answer

Same output shows all the time in structure.. How can I fix it?

Below is the code of an example of structure. When I add multiple information for different person all the time it shows output same the last inserted information. How can I fix it? #include #include struct Person{ char…
Turjo
  • 11
  • 4
1
vote
0 answers

Usefulness of having folders (containing python files) without __init__.py file in a python project?

Is there any case (testing or whatever etc...) or usefulness to have a folder containing python files without the __init__.py file? i.e: project/ run.py package1/ file1.py …
alect
  • 103
  • 1
  • 6
1
vote
1 answer

how to call a c-function expecting a pointer to a structure with ctypes?

I face the following problem. In C I wrote the following: #include typedef struct { double *arr; int length; } str; void f(str*); int main (void){ double x[3] = {0.1,0.2,0.3}; str aa; aa.length = 3; aa.arr = x; f(&aa); …
chris
  • 11
  • 1