структуры

Dynamic array of structures

#include <iostream> #include <Windows.h> #include <conio.h> #include <string.h> #include <stdlib.h ... the first entered score is a healthy left number. Well, I would like to hear what kind of shoals immediately catch your eye.

Dynamic memory allocation in C

The question will probably seem simple, but not for me. The size is unknown in advance, it all depends on the user's desire. ... w much will need to be added, everything is decided in prime time. Or is everything solved by declaring struct Book** books?

how to free up memory with free()

The class creates a structure and a pointer to it. In the constructor, the necessary memory is allocated for the structure. A ... the structure. How do I do this correctly using the free () function ? if (pData) free(pData->matrix); // это не работает

Implementation of the task using the c++stack

Task: divide the stack into 2 stacks. One has even numbers, the other has odd numbers. I got confused with the implementation ... t;< "Положили в нечётный стек:" << x << endl; }; } EvenPrint(begin1); OddPrint(begin2); }

Displaying an array of structures on the screen as a table

Data storage must be organized as an array structures. The program must implement the following functions: Creating a new r ... can't display an array of structures on the screen as a table. I have already prescribed the functions, but it does not work.

Classes vs. Structures

Should I use structures in my C++ codes? I understand the structures are remnants of the C language. On the one hand, structures are easier to write and use than classes, but they undermine the principles of OOP.

Create an array of structures with students in C

When creating a function that adds students to an array of structures, it highlights them in red. Here is the entire code # ... student res_st; scrcpy_s(res_st, 50, name); } Why can't I create the addStudent function? Thank you in advance.

describe the structure using union and enum in C++

Please help me understand the use of union and enum. My task: Describe a structure named TRAIN that contains the fields: nam ... evel is not very good(((((((( I was able to write code without union and enum, but I don't think it will help here in any way

Why does an empty structure weigh 1 byte?

struct t1 {}; int s0 = sizeof(t1); // почему 1, а не 0?

Qsort in C structures

Hello. I really hope for your help. Trying to ride the qsort() function on C. There are certain problems. The program quickly ... horLast, booksA[i].value);}; } else if ((b>6)&&(b<1)) {printf("Ne vibraly? Its bad!\n"); return 0;}

Structures in C# and its advantages

Where can I use the structures? And in what situations is it better to resort to structures rather than classes?

Initialization of the C and C++structure

There is a structure of the form typedef struct struct_name { struct another_struct_name { typefield1 fie ... p = {&some_an_s}; const struct_name_t name = {temp}; Similar error. How to initialize this structure correctly in C++?

List based on C++static structure

I implemented a list based on a static structure, and line 5 and 17 disappear somewhere during the output. Please tell me wha ... List[i].spot << ':' << ' ' << List[i].name << endl; }; cout << ' ' << endl; }

All c++Data Types

What are the data types in C++? Who could logically put it in its place? There are standard types (int, double...), custom class types and aggregate (structures). Right? Please correct me

Sorting complex structures using the bubble method

Is it possible to sort records in a file by comparing a separate field of a char structure with bubble sorting? If so, how? P ... db[i].date << "\t" << db[i].advocate << endl ; } delete[] db; getch(); return 0; }

segmentation fault 11 when compiling on the command line

I have a problem, maybe someone can help, this is a deca program, with the ability to add and remove numbers from both the en ... cnt++) { printf("%d ", dequeue_pop_front(&dq)); } printf("\n"); dequeue_destroy(&dq); printf("\n"); return 0; }

Colon in the structure fields

Please explain how the structure is created here? What does the colon : do? /** * @brief Bit-field structure of the state o ... :1; /*!< A sign individual package (MAC corresponds to the set). */ }ETH_StatusPacketReceptionBitFileds;

What's the exception: the Pnext read access violation was 0xC?

I write a program that displays a table with student data.(Full name, date of birth, age). The program is running, but it ret ... fathername, o[i], f[i], s[i], &ch[i].d, &ch[i].y, &ch[i].m, &ch[i].a); system("pause"); return 0; }

sizeof () and bit fields

Here is the structure: struct Data { char A : 4; unsigned B: 12; }; If you remove the A field in it, then sizeof(D ... B field, sizeof(Data) returns 1. Normal. And if you leave A and B, then sizeof(Data) returns 8!. Unclear. Why 8 and not 5?

Using the stack in a function(changing the structure by pointing to the structure) .

There is a code of the following type, how will the stack be used when calling the function init_function? The stack will be ... Data->b = 0x7F; Data->c = 0x1; return(Data); } int main(void) { Struct_t *init = init_function(); //Do some... }