Questions tagged as 'c'

0
answers

In C, how to compare a string obtained from strtok with another string

Well, in my case, I'm working on file manipulation, nothing complicated, but I came up with a problem that I can not solve, and because of the lack of definition in the searches, it's difficult to find a similar problem and solved on the interne...
asked by 01.06.2018 / 03:33
0
answers

Question about the fork system call

int main(){ int x = 2; pid_t p = fork(); // esta variavel guarda o id do processo criado?! if (p > 0) x--; // o processo em execução é o pai, neste caso decrementa para 1, e onde é guardado esse valor? else if (p == 0){ pid_t t = fork(...
asked by 03.06.2018 / 16:09
1
answer

Fibonacci sequence in C

I'm doing a college exercise where the user must enter a number and the program should return the Fibonacci sequence. However, according to the teacher, it should start at 0 (ZERO), but my program starts at 1. Note: The teacher has already co...
asked by 24.05.2018 / 00:38
1
answer

Null list error

I'm having a problem, my code is running right the 3 option only the first time if I go back to the menu and try again it appears nulla. The case 3 is to list a list of names in reverse alphabetical and alphabetical order (InsertOrd 0 / I...
asked by 26.05.2018 / 21:06
1
answer

How to pass, by reference, a vector of structures to a function?

I'm having a hard time understanding the passing by reference of a vector of structures. There is no running error, but I'm not sure if I'm reading the file right there. #include <stdio.h> #include <stdlib.h> #includ...
asked by 23.05.2018 / 16:00
1
answer

Method for calculating harmonic media!

I need some help to perform a harmonic media calculation of an "infinite" series so to speak. Ex. I have a data capture system that is always injecting information into a DB. But there are many points added every minute and I need to generate a...
asked by 26.05.2018 / 17:10
0
answers

Doubt when creating structs, relating one struct to another

I have created the following structs: typedef struct cliente{ unsigned long int codigo; char nome[50]; char endereco[50]; char cpf[11]; char idade[3]; struct cliente* prox; }Cliente; typedef struct funcionario{ uns...
asked by 18.05.2018 / 01:54
1
answer

InsertSort in Double-chained list ... unsuccessful

I'm trying to implement the InsertSort method but so far unsuccessful .. Could someone give me that strength? void insertionSort(ListDN *l){ int ordered = 0,i,j; Dnode *cursor = l->head->next ; Dnode *aux; Dnode *temp; while(!ordered)...
asked by 22.05.2018 / 21:25
1
answer

how to pass two structs by function

I have two structs, one for student data and one for a hash table, where the collisions of the matriculas go. To know if there was a precise collision between these two structs, but the dev says there are some errors when I try to pass the two f...
asked by 16.05.2018 / 02:02
1
answer

How to create simple threaded list circular in C?

NOTE: The first element I am inserting out of the chi, this is the second on, the while will run until the user types the id of a student -1 q ta in the create function. It's falling into an infinite loop! void inserir(Aluno *aluno){ while(1)...
asked by 20.05.2018 / 21:14