Questions tagged as 'struct'

1
answer

How to sort a struct within a struct

I want to do sorting of a struct that is referenced inside another struct: Detail: can be sorted using selection sort typedef struct{ int tipo; char dispositivo[50]; int prioridade; }Perif; typedef struct no{ Perif info;...
asked by 06.06.2016 / 08:48
2
answers

Free () in struct with char array

I have struct struct data { int code; char name[50]; char feature[30]; }; typedef struct data Data; and the function: void free_data(Data *data) { if (data != NULL) free(data); } But free () is not making the...
asked by 22.10.2017 / 00:40
2
answers

How could I insert the structs into a list? [closed]

#include "stdafx.h" #include <iostream> using namespace std; struct FICHA_INSCRICAO { char nome[50]; char cpf[10]; char logradouro[100]; char bairro[20]; char cidade[20]; char estado[1]; char email[50]; cha...
asked by 07.10.2016 / 23:09
1
answer

Problem with Struct

I have the following error in my code:    error: request for member 'media' in 'given', wich is of non-class type   'DataAluno [5]' Code: #include <iostream> using namespace std; struct DadosAluno{ int idade[5]; f...
asked by 13.02.2015 / 06:33
2
answers

Sort a struct

Do you have some way to sort% of the form: struct cidadecoord { char cidade[90]; int coordx, coordy; }cidades[N]; N is worth 30 in the case, and I would like to order the coordinates x and y, to find out which cities were more to the ea...
asked by 30.11.2014 / 19:18
2
answers

Error in struct member access passed by reference

I have the code below that has a function to set the salary = 4000, but it returns the following error:    [Error] request for member 'salary' in something not a structure or union The error occurs on the line that I try to set the salary...
asked by 22.06.2014 / 17:07
1
answer

Struct! You are giving error on line 47 at the time it compiles, Follow the program in c

#define MAX 50 struct{ int ra; char nome[MAX]; float prova; }aluno[5]; int main(){ struct aluno; int i; int j; printf("Determine o Nome do Aluno %d: ", i+1); printf("Determine a Matricula do Aluno &d: ", i+1)...
asked by 17.06.2018 / 02:18
2
answers

Accessing variables from a struct

I'm studying C and I'm doubtful about the difference of the following lines: (*depois).agora = 20 and *depois.agora = 20; So I understood the point . has priority and the compiler would try to solve depois.agora and after...
asked by 08.10.2017 / 18:37
2
answers

"goto" command creating infinite loop in loop "for"

I want to simulate a school database that collects names, math and physics grades, and calculates the mean of both to 5 students (defined in a string of struct ). Any grade above 10 would be allowed, with no lock for that. Students wo...
asked by 28.09.2017 / 14:52
2
answers

how do I access the values of a struct?

I need to print the read values on the keyboard of a struct vector that form a coordinate. The problem is that when I pass the struct vector of the function that picks up and stores the data for function that will print them on the screen, the o...
asked by 08.12.2016 / 00:57