Questions tagged as 'struct'

1
answer

Array of pointers with struct

I am trying to assign 3 names to a string vector within a struct, and using pointers to reference the dynamically allocated struct, and then print and reverse it in a repeat structure, but when trying to print it it is not returned nothing....
asked by 10.11.2018 / 00:09
1
answer

How to check if the vector of a record is empty in C

I have this record: typedef struct{ char nome[200], telefone[200], email[200]; } Agenda; Agenda contato; Agenda vetor[300]; And I want to print only those records that have data: int lista_contatos(void){ printf("========== Cont...
asked by 29.10.2018 / 15:55
1
answer

How to adjust the format dd / mm / yyyy

I have the following code that takes the instant computer date. #include <Windows.h> #include <stdio.h> #include <time.h> void main () { time_t t = time(NULL); struct tm tm = *localtime(&t); printf("Agora: %...
asked by 24.10.2014 / 02:25
1
answer

Statement of Pointers in a struct and calling it in function

I should solve the following problem by creating a function for reading, one for calculation and use pointers. #include<stdio.h>#include<stdlib.h>#include<math.h>structponto{intx;inty;}ponto1,ponto2;structponto*p1,*p2;p1=&a...
asked by 18.05.2018 / 13:50
1
answer

Syntax errors in C [closed]

I'm doing this exercise in C, but I caught that part of passing pointer parameters. Basically the program below adds the portion of real numbers and integers. The problem is that the current results are: a = 12 (correct!) b = 10 (...
asked by 31.05.2018 / 18:55
1
answer

Statement and initialization of struct outside the main function in C

I'm doing a little game in C that has the letter structure: typedef struct { int numero; int cor; } TipoCarta; A method for placing the values in the chart: void inicializaCarta(TipoCarta *carta, int num, int cor){ carta->n...
asked by 12.06.2018 / 02:10
1
answer

Principle value of a struct through pointers

I want to print the "attribute" name of a struct of type "Person", however the printf returns (null) but I declare the name of the struct. Here is the code below: typedef struct pessoa{ char *nome; struct pessoa *pai; struct pessoa *mae...
asked by 19.05.2018 / 04:46
2
answers

Program Ignoring Scanf

I need to create an algorithm as a request below, however, every time I run the program it "skips" steps. For example: I want you to stay like this Product: "Potato" Sector: "Food" Quantity: "15" Price: "15.23" But it prints on...
asked by 13.05.2018 / 22:12
1
answer

Switch command does not work and does not display errors

I am trying to solve the following exercise: Elaborate an algorithm that assists in the control of a cattle farm that has a total of 2000 head of cattle. The database is formed by a set of structures (records) containing the following fields for...
asked by 12.05.2018 / 02:57
1
answer

Error in the average calculation of a student record

printf("Nota 1: "); scanf("%.1f", &alu[n].not1); printf("Nota 2: "); scanf("%.1f", &alu[n].not2); alu[n].media = (alu[n].not1+alu[n].not2)/2; // o erro acontece NESSA LINHA    invalid operands to binary + (have 'float *' and 'float *'...
asked by 02.11.2017 / 21:40