Questions tagged as 'c'

1
answer

Problem removing at first in a double-chained list

Hello. When I try to use the "remove" function to remove the first element from the list, apparently nothing happens. But, shortly after using the function remove and try to insert a new node in the list, it does not insert, and the second time...
asked by 16.09.2018 / 01:23
1
answer

How to sort an array by the frequency of appearance of each element?

In order not to overstretch I'm going straight to the point, I'm trying to make a program for an exercise that has the following statement:    Build an efficient int ordenaFreq(int v[], int n) function, ie runtime   in the worst case it must...
asked by 11.09.2018 / 22:01
0
answers

Difficulty with a loop "for" in C [closed]

I'm developing a forcing game in the C language, however I'm having trouble finding where the problem is in the main function program, the play function. I believe the problem is in the for loop, but I've tried everything and still can no...
asked by 21.11.2018 / 02:59
2
answers

Using float to check for overflow in unsigned long int

Hello, how are you? Please review this code: #define max 4294967295 unsigned long int collatz(unsigned long int n, unsigned long int passos, float *maiorN) { float overflow = 3 * n + 1; if (n == 1) return passos; else if (...
asked by 24.08.2018 / 22:14
1
answer

How to modularize the following C code

Below is a code for user input and validation, but I would like to modularize it. I do not know if there is a possibility of using it out of the box, or in an external file (eg "validation.h"). Can I make him leaner? Thanks in advance. Edit1:...
asked by 18.06.2018 / 09:40
1
answer

Can anyone tell me what's wrong with this code? [closed]

I am creating a function that receives and breaks a string into several, depending on the delimiter (s) chosen by the programmer. So I have: void split(const wchar_t* text, const wchar_t* seps,wchar_t ***str, int *count) text: the string t...
asked by 03.06.2018 / 16:44
0
answers

Protocol NBR 14522

I am developing software for communication with meter via serial port, and I am able to send the commands via serial, it follows the codes: int serial_open(const char *device, int baud) { struct termios tio; int fd = open(device, O_...
asked by 22.10.2018 / 13:05
1
answer

Error printing member of struct: request for member in something not a structure or union

I have the following struct : typedef struct{ int Numerador ; int Denominador ; } TNumeroRacional ; In this function I ask the user to enter 2 numerators and denominators to form 2 rational numbers. void Atribuir (TNumeroRac...
asked by 02.09.2018 / 00:04
1
answer

Changing letters in C [duplicate]

I have a question, I'm making an algorithm that takes the user's phrase that does not have sense, as if it were a code, to solve it has a key that is the letters that come out most of the Portuguese alphabet, to solve I have to associate each...
asked by 21.04.2018 / 18:46
1
answer

Problems in reading and organizing a matrix in C

I have two files .txt , and each has a 2x8 array. I need to read these files and compare them, line by line, and when the line of both is equal, add to a counter. However, the problem I am facing is this: after reading both arrays, a...
asked by 23.06.2018 / 19:37