Questions tagged as 'c'

1
answer

Problems organizing a struct in C

I'm having trouble organizing the data of a struct, the data is even organizing, but I always end up getting memory garbage in the first position, the others are organized normally without errors. The structure should be in descending order acco...
asked by 11.10.2017 / 00:24
2
answers

Vector by Parameter in C

I need to pass the position of Vector per parameter as follows code, my function receives the address and directly modifies the variable passed by parameter. However the program stops working and closes during compilation. Can someone help me ??...
asked by 10.10.2017 / 15:10
0
answers

Lottery game program using matrix

I need to make a program in C, that the user enters 5 sets of 6 tens stored in a 5x6 array. I need to create a function that will sort a game of six tens stored in a vector of 6 positions and another function that verifies that the user has hit...
asked by 15.10.2017 / 16:41
1
answer

Problem passing array as parameter

I'm not able to pass the array parameters correctly to the calculos function. The code compiles correctly, but the function does not get the values I'm trying to pass. Since it is an array of type struct, this should be the problem. #in...
asked by 07.10.2017 / 14:47
1
answer

I learned to pass a vector as a parameter, I would like to change and return the vector (vector_y1) to main, how can I do it without allocating? Please

#include <stdio.h> #include <stdlib.h> #include <locale.h> int vetor_y1(); int main(){ setlocale(LC_ALL, "Portuguese"); int i,j; printf("Inf. o tamanho do vetor: "); scanf("%d",&i); int vetor[i]; fo...
asked by 20.10.2017 / 00:17
1
answer

Compile error "undefined reference to 'sqrt'" in Atom editor

This code in C is not compiling on Atom, but CodeBlocks is working normally. #include <stdio.h> #include <math.h> int main(){ int a, b, hipotenusa, catetos; printf("A: "); scanf("%d", &a); printf("B: ");...
asked by 14.10.2017 / 07:13
1
answer

Files For Structs / C Pointers

I have this little program and I am able to save, and load from the file to struct (not perfectly). The error is as follows: after loading the file to struct, if in the function load by printf it will correctly print all the files of the stru...
asked by 04.10.2017 / 05:20
0
answers

Pass by reference

In an exercise, I need to compare a certain number of distances and say which one or which are the smallest and print them out. For this, I have the following function: void Permuta(FILE *saida, Cidade *C, int *sequencia, int inicio, int termi...
asked by 03.10.2017 / 16:04
1
answer

exercise on pointers

Implements the void power_ref(int* x, int y) function that calculates the power of x leading to y . The result should be placed in the address indicated in the first parameter, changing its initial value. I have something...
asked by 30.09.2017 / 21:55
0
answers

Code with Sockets locking in the middle

Because of college networking stuff, lately I have had experiences to learn how to deal with sockets in C. But today, trying to develop a candle game to practice, I had a rather peculiar problem. Apparently, the code I wrote does not have any syn...
asked by 07.10.2017 / 03:10