Questions tagged as 'struct'

2
answers

Doubt over struct and list in c

I'm in trouble when I need to give a person value, in this case I need to give the name and age value to the person. I tried to create a struct PESSOA and a list that contains a person and an id, but during compilation it presents / displ...
asked by 05.08.2017 / 20:47
1
answer

C - Structures for point, polygonal line and polygon

Good evening The exercise asks me to implement three structs: Point (X and Y coordinates), polygonal lines (sequence of 2 to 100 points that are the vertices along the line) and polygon (sequence of 3 to 100 points that are the vertices along...
asked by 29.05.2017 / 04:13
2
answers

Converting a vectorstruct in C ++ in C

I'm trying to adapt a C ++ function in pure C. I changed the names of the variables and structs because it is not the case. typedef struct struct1 { int a; int b; int c; string d; } STRUCT1; typedef struct struct2 {...
asked by 18.11.2016 / 00:44
1
answer

strcpy () in struct string

I have a struct Time that has a char name[30] vector, the problem starts when I try to copy a value to this string with the function strcpy() , it follows the code of stuct : typedef struct Time{ char name[30];...
asked by 31.10.2016 / 12:01
1
answer

Compile error with struct

When trying to compile I am facing the following error: ..: error: storage size of 'PPFila' isn't known ..: error: storage size of 'AUTFila' isn't known In this line of code struct Fila PPFila, AUTFila; The struct Queue is bein...
asked by 26.07.2016 / 20:59
1
answer

Struct with vector is not working

I'm trying to use vectors and struct , but it's not working. #include <stdio.h> #include <stdlib.h> typedef struct Atleta { float notas[5]; } atleta; void receberNotas(atleta* l) { int i; for(i=0; i<5; i...
asked by 28.09.2016 / 00:59
2
answers

How do I access the pointer of a struct within the pointer of another struct?

typedef struct vertice { int num_vertice; int profundidade; struct vertice **vertices_adja; } Vertice; typedef struct grafo { int qtd_vertices; int *Vertice; } Grafo; I want to access the attributes of the...
asked by 06.10.2015 / 16:07
4
answers

"Pure" structs (without pointer) and error handling in C

Stirring with data structures ( filas , pilhas , etc), I got stuck trying to create search functions for these structures. By default, functions that may contain errors return 0 or -1 when the return type is an integer.    But...
asked by 24.05.2015 / 02:35
1
answer

Pass and return vector of type defined by struct as parameter of a function in C

I'm finding errors for the following code: #include<stdlib.h> #include<stdio.h> #include<stdbool.h> #include <locale.h> #define true 1 #define false 0 const int limite = 100; //Definição da estrutura Conjunto como um...
asked by 09.04.2015 / 11:51
2
answers

Segmentation Fault in array of Structs C

I'm trying to make an array of dynamic structs in C, however I'm not understanding why it's returning me segmentation fault. The code is basically this: I'm just creating a vector of 10 arrays and then trying to initialize each struct indi...
asked by 09.10.2014 / 14:49