Questions tagged as 'struct'

0
answers

Sort a pointer inside a struct

In this chained list, a vector of 10 positions is set. First, you must choose which position to complete and then how many values to add (% with%). So far so good. The problem is that I'm trying to sort the vectors incrementally, but I'm d...
asked by 11.03.2018 / 00:21
1
answer

Call a function based on struct passed in reference?

How do I call the menu function by passing more than one struct per reference according to validation in the validation function? I'm sorry I'm starting now and I decided to do this little exercise to practice functions, classes, and structs...
asked by 10.01.2018 / 14:04
2
answers

Array of struct accepting more than defined, what's wrong?

In the code I created an array of type Pessoa containing only 2, but when it begins to iterate in the for loop and accesses index 2 and 3 the string continues without generating compile-time error nor execution. Is this behavior normal?...
asked by 10.11.2017 / 02:01
1
answer

Segmentation float when starting the function for the second time

I created a program in c ++ to manipulate arrays, and split the source code into 2 files, one with functions and the other with implementation, all functions work correctly, however when starting any function for the second time, regardless of w...
asked by 18.10.2017 / 19:45
1
answer

Files For Structs / C Pointers

I have this little program and I am able to save, and load from the file to struct (not perfectly). The error is as follows: after loading the file to struct, if in the function load by printf it will correctly print all the files of the stru...
asked by 04.10.2017 / 05:20
1
answer

Printing the smallest distances

The exercise asks me to print the smallest routes between n cities, considering that the last one is the same city as the starting point. First, I need to read an input file like the following: 5 1 10 4 4 5 1 2 0 7 21 Where the first...
asked by 01.10.2017 / 23:38
1
answer

Chained list returning empty out of function

I'm trying to read data from a .obj file and insert it into a linked list, I have a function to read and inside it I call the insert function. When I call the function to print the list inside the read function after having entered all th...
asked by 15.09.2017 / 02:27
1
answer

Batteries with sequential allocation

I'm having trouble implementing the code in a stack using vectors: typedef struct pilha pilha; struct pilha { int *v; int topo; int tam_max; }; void Inicializar_Pilha (pilha pi, int tam_max) { pi.v=new int [tam_max]; p...
asked by 15.09.2017 / 07:21
2
answers

records matrix vector

Students were asked to replicate a teacher-designed scheme in the classroom. In this scheme he made a vector, within each position he made a matrix and within each position of the matrix he designed a structure containing name, address and age....
asked by 09.08.2017 / 19:42
1
answer

How to make variable receive function argument value?

Next: I have a code for how to create a one-point structure in an RxR plane. In case, I would like to access the "x" value of a point. Here are the codes: Point.h file: //Arquivo Ponto.h typedef struct ponto Ponto; //Cria um novo ponto...
asked by 11.06.2017 / 14:41