Questions tagged as 'struct'

1
answer

Why is the size of a struct not the sum of the sizes of its variables?

For example, the following code: #include <stdio.h> struct exemplo{ char letra; int numero; float flutuante; }; int main() { printf("Tamanho do char: %u\n", sizeof(char)); printf("Tamanho do int: %u\n", sizeof(int))...
asked by 24.04.2016 / 21:24
1
answer

Typedef struct with C character vector is not working

I'm trying to create a constructive data type, but I'm having trouble with the strings. typedef struct { char nome[30]; int idade; } p; p x,y; x.nome = “ana”; x.idade = 20; y.nome = “caio”; y.idade...
asked by 02.02.2017 / 01:02
3
answers

How to set a Struct to NULL in C?

I want to check if there is any content in struct so I wanted to initialize the variables as NULL , because if they were equal to NULL would know that they were not created. excerpts: Struct: struct Fila { int...
asked by 26.07.2016 / 20:08
2
answers

Faster way to add an item to a list, use a structure

Structure turma Public id_turma As Integer Public nome_turma As String End Structure Structure Disciplina Public id_disciplinas As Integer Public nome_disciplina As Integer End Structure Public Class F_Contentor Dim turmas A...
asked by 22.02.2016 / 18:35
1
answer

C socket for Linux (how to pass a struct?)

I have a client / server application and I need to transfer a struct to the server, but this is not working: typedef struct{ int pontos; int vidas; int flagReiniciar; int flagAcabar; int matriz[21][19]; } dados; send(sockfd,&...
asked by 14.09.2015 / 07:04
1
answer

Working with Struct and problem in print, changing Struct and deleting a Struct [closed]

I have a job of the faculty to do that is to create a struct of "Library Register" (cataloging code, name of the work, name of the author, publisher, donated works of each area, number of pages) with options of "Register book, search for catalog...
asked by 19.06.2014 / 19:20
1
answer

How to do math operations with a struct? [duplicate]

I have the following structure: public struct vetor { public float X, Y; public vetor(float X, float Y) { this.X = X; this.Y = Y; } } And this code: Vars.vetor _visao; Vars.vetor _recoil; //Os 2 possuem v...
asked by 20.08.2017 / 00:45
1
answer

How to interpret this line? (struct list *) 0)

while (variavel != (struct lista*)0) { ... } How to interpret (struct lista*)0) ? What does that mean?     
asked by 18.09.2018 / 22:15
1
answer

Passing data from a struct within the function

To do a college job where I have a separate function that gets two values (WEIGHT and HEIGHT) and returns the BMI. I also have a struct called ALUNO where weight and height are stored and a vector of 20 positions that will store the structure...
asked by 26.05.2018 / 04:51
1
answer

How is a struct organized in memory?

How does access to struct work? Can I put the members in the order I want? How does the compiler know which part of memory it should access? How would this look? struct { char ch1; short s; char ch2; long long ll; int i;...
asked by 10.02.2017 / 13:37