Questions tagged as 'c'

1
answer

Problems with Realloc

Good afternoon, I'm having trouble creating a program that will increase the size of a designated list structure, similar to an array, whenever the occupancy rate of this list is more than 80% filled, I would like to increase it 2 times the size...
asked by 14.05.2018 / 19:54
2
answers

Error adding each row of a 5x3 array

Hello, I'm having a problem adding up each of the rows in my array and storing it in a vector My code is like this: #include <stdio.h> int conta(int * matriz[5][3], int * vet) { for (int i = 0 ; i<5; i++) { for (int j =...
asked by 06.11.2018 / 23:15
2
answers

Change letter by number in C

I'm trying to program a phone algorithm with the old keys where the user will enter the letters as input and the output will return me in the form of numbers. Look at an example below: Entry: Hello-World Output: 43556-96753 I've tried t...
asked by 04.11.2018 / 22:01
2
answers

Problem with arrays in C

I have to make a program that will read 4 notes from each of the 6 students in a class and store them in an array NOTES [6] [5]. For each student, one should calculate the arithmetic mean of the 4 notes and store this average in the last column...
asked by 10.05.2018 / 02:18
2
answers

Giving "Segmentation fault" when trying to open files in C

The following code gives me "Segmentation fault (core dumped)" when trying to open the file after declaration and filling a string with sprintf. //Sem as duas seguintes linhas, o código roda normalmente char Xseqpath[90]; sprintf(Xseqpath, "%s...
asked by 12.04.2018 / 14:18
1
answer

Use Linux libraries

I'm developing software in C that receives information and needs to verify that it is correct through a CRC-16, searching I found a lib only for CRC called libcrc.org but I also found something in linux and would like to use the which is native...
asked by 06.03.2018 / 19:23
1
answer

Maximum size possible to allocate a vector

Folks, I have a data structure project that is used to analyze search algorithms in the largest possible vector that my machine can allocate. Can anyone help me figure out how to create a vector of maximum size? The language is C ++     
asked by 14.03.2018 / 17:29
1
answer

How to set the number of exponent numbers in scientific notation in C ++

My code is giving the error in the presentation of the scientific number, because it always appears with 3 decimal places being needed only. #include <stdio.h> int main(){ float num=0.0; scanf("%f",&num); printf("%.4e",...
asked by 05.09.2018 / 20:23
1
answer

Snake game, try a beginner C / C ++

Hello, I'm doing the snake game, but I'm doing with an array, the way I'm doing is giving prints and system ("cls") quickly, but I'd like to know more efficient ways, like for example the gotoxy Code to give print to screen: int i, j; cout<...
asked by 02.08.2018 / 13:23
1
answer

How to implement a Recursive Merge

I have a MergeSort algorithm and would like to implement the merge function recursively, not the recursive MergeSort but the Merge function of it. Here is the Merge Function and Merge Sort code: void mergeInt (int v[], int inicio, int fim) {...
asked by 21.07.2018 / 19:39