Questions tagged as 'c'

1
answer

Pointer to struct for struct

Hello, I had asked a previous question about this problem, but I managed to solve it but did not learn about the problem itself so I tried to isolate it by creating a specific code for this problem and I would like someone to teach me what is hap...
asked by 27.05.2016 / 06:39
1
answer

Improved C-code performance

I had a test where the question was: Considering that the periods of history are four: (1) a period prior to 4000 BC; (2) from 3999 BC to 476 AD; (3) from 477 AD to 1789 AD; and (4) after 1790 AD. Note that BC corresponds to BC...
asked by 13.05.2016 / 22:46
1
answer

Semaphore and Mutex in C

I have the following problem: A lan house with 3 pcs, I will insert an X value in the terminal that will be the number of clients that arrive in the lan house, customers can only use the pcs that are unoccupied, if you are busy go to a waitin...
asked by 29.05.2016 / 00:29
1
answer

How do I eleminate repeated numbers in c

My problem is that I can not delete repeated numbers. First thing my algorithm does is organize the elements, then in the method eleminar_numeros_repetidos copy to second vector that is vec1.only after I start to delete. Arquivo função1.c: v...
asked by 02.10.2016 / 01:03
1
answer

Unsigned modifier for integer type in C

The works say that this modifier causes the variable not to accept negative values, but when I compile this code: #include <stdio.h> void main() { unsigned int idade; idade = -3; /* Não existe idade negativa */ printf("Id...
asked by 02.10.2016 / 16:47
2
answers

How do I pass an array of structure pointers to a function?

#include <stdio.h> #include <stdlib.h> #define NUM_NOTAS 5 #define TAM_NOME 20 struct Aluno{ char nome[TAM_NOME]; int numero; int notas[NUM_NOTAS]; }; void preenche(struct Aluno* lista[], int tam){ int i; int j; for(i=0;i<...
asked by 04.01.2017 / 16:31
1
answer

How to solve the recurrence function T (n) = 2T (n ^ 1/2) + logn? Book Exercise Cormen cap 4 [closed]

In the book of Cormen, Cap 4 details how to solve func- tions of recorrecia (Cap 4). One of the exercises asks to solve. I tried using the tree and the induction but I could not move. How to reduce the log n and n ^ 1/2 values so that you can ch...
asked by 11.04.2016 / 15:46
1
answer

How to relate two data structures of the list type

I am developing a project to better understand data structure, in the project is being used data structure of type list and in it I must register students and after the registered, I can choose any student that is registered to include a quant...
asked by 05.01.2017 / 15:09
1
answer

How to connect a struct in the other?

I started programming in C recently and I have a question about structs , I would like to know if it is possible to connect two structs to simulate a relationship between tables, for example struct categoria : struct categor...
asked by 11.12.2015 / 15:56
2
answers

C ++ doubts do-while loop

Good people, I have the following doubt: Every time I run this program the do-while loop does not stop at the second loop scanf in the program and ends up running twice and displaying the error message. I'd like to know how to fix this bug....
asked by 15.01.2016 / 13:12