Questions tagged as 'struct'

1
answer

How to pass a struct dynamically allocated to a function in C?

The program should dynamically allocate the struct and pass it as a parameter. #include <stdio.h> #include <stdlib.h> typedef struct cadastro_de_mercadoria{ int codigo; int estoque; } CADASTRO; void printar(CADASTRO cadas...
asked by 02.10.2018 / 04:00
1
answer

Problem to assign more than one value to variable

#include <stdio.h> int main(){ int d; int e; int peca1; printf("digite um lado da peca: "); scanf("%i", &d); printf("digite outro lado da peca: "); scanf("%i", &e); peca1 = d , e printf("%i, %i", peca1); return 0; } I w...
asked by 12.05.2016 / 20:24
2
answers

Dynamic allocation for struct

I need to dynamically allocate space for a structure, but I'm not getting it and I do not know my error is at the time of the declaration or allocation, follow the functions consistent with the declaration. Statement struct { char nome[...
asked by 25.11.2014 / 00:00
1
answer

Line break when typing entries

I have a vector of structs with 10 people and I want my registration function to receive only one person at a time. At the terminal, the first person's registration is done correctly but after I get this "break" line, it jumps alone from the...
asked by 22.12.2015 / 14:55
1
answer

Vector struct and pointers

I have to get data (name and phone) from some people in a struct , then store them in a vector, all by a function / procedure. At the time of printing some strange characters come out. I'm using the C ++ DEV platform # include <std...
asked by 15.10.2014 / 23:51
1
answer

C pointers

Well guys, I'm doing graph theory in C, and I've tried using dynamic allocation to create an array. Also, my code has a function to populate the array with 1 in the received indexes. However I have some error in the array allocation or in its pa...
asked by 17.08.2018 / 22:07
1
answer

C - How to pass a vector in which contains pointers to struct as a function parameter?

First I created a struct vector. Next I have created a vector of pointers, in which each element of this vector points to each element of the struct vector. Finally, I need to pass both the vector of structs and the vector of pointers as para...
asked by 17.09.2018 / 05:52
2
answers

Using struct in C #

I have to record customer information. And I used struct to do this. Is it worth doing this? Is it good practice or not?     
asked by 02.06.2018 / 05:06
1
answer

How to assign array of characters in a structure?

The program reads 10 movies, each movie has genre name, and age rating, then the list; I can not assign array of string (I believe this is only this error) #include <stdlib.h> #include <stdio.h> #include <stri...
asked by 25.10.2018 / 22:37
1
answer

typedef struct syntax

What is the difference between writing typedef struct "nome1"{}"NOME2"; , as implemented in a linked list; and typedef struct{}"NOME1"; , as implemented in the sequential list I've seen. I've also come across struct "nome1"{}ty...
asked by 19.08.2017 / 00:04