Questions tagged as 'struct'

2
answers

Is it wrong to mix struct with class in C ++?

I have the following class: #ifndef PESSOA_H_INCLUDED #define PESSOA_H_INCLUDED #include <string> struct aniver{ int dia; int mes; int ano; }; class Pessoa{ private: std::string nome; std::string sex...
asked by 17.12.2017 / 06:18
1
answer

Struct address for INT

I have the following Struct: struct nodo{ int elo_a; char nick[26]; char cidade[16]; int idade; int elo_p;}; I have two struct assignments: struct nodo *variavel; struct nodo *offline; Okay, I already inserted a value in offline, sett...
asked by 07.11.2017 / 01:34
1
answer

How to pass structure to function?

   An agency in a country town has a maximum of 10,000 customers. Create an algorithm that can enter account number, name and balance of each client. The algorithm should print all accounts, their balances and one of the messages: positive / neg...
asked by 23.11.2017 / 21:06
1
answer

Error declaring an array

I made an array [day] [time], but I get an error initializing it. I get this error and I do not know how to fix it    error : attribute The code looks like this: struct horario{ char M[8][40] = {{"X 8 9 10 11 12 13 14 15 16 17...
asked by 23.07.2017 / 18:54
1
answer

Reading odd-numbered records only

Initially, I had to create a program to save the data of a struct to a file. The struct is as follows: typedef struct { char nome[30]; int matricula; char conceito; } TipoAluno; I made the program in a way that saved the data in...
asked by 22.08.2017 / 16:20
1
answer

Passing by reference, and saving data from a file to a vector

I'm having trouble saving the read data from a text file and a vector from a structure I created. My goal is to open a text file, grab the data that is saved in it, and save it to a vector of type INFO. My program compiles perfectly, but when...
asked by 20.08.2017 / 06:13
1
answer

Problems with dynamic and struct allocation

I want to create a struct where there will be a vector of structs ... The way I thought about doing this was something like this: typedef struct{ char *teste_str; int teste_int; }TESTE_A; typedef struct{ TESTE_A **t;...
asked by 21.05.2017 / 15:33
1
answer

Relationship between structs in C

I have the following scenario: typedef struct Unidade{ int cod; } und; typedef struct Produto{ int cod; char nome[100]; und unidade; } prod; As you can see, I have a unit-type variable inside the product. How do I record th...
asked by 11.05.2017 / 19:52
1
answer

Vector of struct in C

I can not find the error in this code of my exercise. It prints right the first reading, then prints random things. I could not find out if the error is in the reading or the printing. #include <stdio.h> #include <stdlib.h> /*Defin...
asked by 26.12.2016 / 01:16
2
answers

calling a function inside another function in c

I need to get float values to store in struct , but I need to validate these values through a validation function. ' The function that validates these values is working correctly, but when I try to call it inside the function it w...
asked by 01.12.2016 / 01:26