Questions tagged as 'c'

1
answer

Shared memory between Linux C processes (mathematical operations)

I am studying shared memory in C language and I need to make a simple program so that a shared variable starts with a value and then the program creates a child process where the variable is going to be incremented by 2 and then the parent proce...
asked by 04.03.2018 / 16:23
4
answers

What are files with .cpp and .h extension?

What are these files with extensions .cpp and .h ? How do they interact?     
asked by 26.09.2017 / 14:47
2
answers

Function that checks if a vector is in ascending order

I'm doing an exercise that says:    Critique the code for the following function, which promises to decide whether the vector   v [0..n-1] is in ascending order. int verifica (int v[], int n) { //n é o tamanho do vetor if (n > 1)...
asked by 06.10.2018 / 03:36
1
answer

Communication with baudrate 110

I have to receive data from an equipment that has a TTL interface that sends the data to 110 bits per second. In all the tests I performed when trying to reach this speed I have problems, for example: My program does not receive the 9 by...
asked by 23.01.2018 / 20:07
1
answer

How to create structure vector within function

Good morning! I was again recovering in the matter of algorithms, what caught me most was structure and passing parameters. I decided to create an activity to train for Monday's recovery.
asked by 15.12.2017 / 12:29
1
answer

Retrieve arguments passed via ARGV in the terminal

I have a make file. Inside this make file, I call this file that has this: set -f; echo $1 | bc I want to retrieve the value of the function in C for this makefile. Example: ./a.out "12 + 12" result: 24     
asked by 11.11.2017 / 08:39
2
answers

Problem in using malloc and realloc

int main() { int **matriz; f(matriz); return 0; } void f(int **matriz) { int x, l=1,c=3; matriz = (int **) malloc(sizeof (int)); *matriz = (int *) malloc(3 * sizeof (int)); printf("Insira o valor de x: "); sca...
asked by 11.11.2017 / 15:30
1
answer

How to make a pointer point to NULL?

I need a position of an element in a dynamic vector to be empty, so I can check if I can put an element inside it later. However, the compiler does not allow it. Here is my code: MATRIZ_ESPARSA *criar_matriz(MATRIZ_ESPARSA *matriz, int nr_linh...
asked by 06.11.2017 / 01:18
1
answer

Problems with gaussian filter application

The function should only apply the Gaussian filter in a PPM image, but the result is several superimposed filtered images. Any suggestions? [edit] before filter image | image after filter | expected result pixel** gauss_filter(pixel**...
asked by 03.11.2017 / 04:39
0
answers

Calculate the shortest possible distance

In an exercise, I need to print all possible paths between cities, where cities are represented by x and y coordinates and the last city is the city of departure. Remembering that you must find the smallest paths to each different...
asked by 21.09.2017 / 15:50