Questions tagged as 'c'

1
answer

How do I get data from a file with fscanf, in c?

Code: while(fscanf(arq,"%d %d %d\n\r",x[i],y[i],raio[i])!=EOF){ cout<<x[i]<<endl; i++; } File content: mdb236rl D CALC B 912 2247 58 mdb240rl D CALC B 1752 776 95 mdb244rm D CIRC B 1940 1209 209 mdb...
asked by 19.02.2018 / 14:15
1
answer

How to create a pointer to save the address of a binary tree root and then use this address to call the root?

Hey guys, I have a problem with my seemingly simple code to solve, but I still get confused with pointers. The code is to insert each digit and operator of an entire parenthesized expression into a binary tree. The logic is, when I find a "("...
asked by 15.02.2018 / 15:40
1
answer

Edit .csv files in C

I need to make a programming code in C, in which I ask the user for the name of a city, present in the first file (cities.csv), and I have to remove the id from the inserted city. Then, this id must match another id, present in a second file (me...
asked by 15.02.2018 / 18:44
0
answers

Remove a line in a .csv file in C language

For a college job, I have two .csv files, and I have to create a function to remove data from those files. But I do not know where to start, and what code to use. I already researched the internet and found nothing. If they give me an example fo...
asked by 17.02.2018 / 00:05
0
answers

variable-sized object may not be initialized

I'm having an error when I ask the WORLD X and WORLD Y values on the command line    error: variable-sized object may not be initialized        AGENT * grid [WORLD_X] [WORLD_Y] = {NULL}; /* Verificar se numero de argumentos foi o correto *...
asked by 06.02.2018 / 01:24
0
answers

Error in Matrix C Printing

I'm trying to fill an array recursively to get how many vector values are the same, but it's not working and I do not know where the problem is. The matrix is generated from the comparison of 2 strings If the values between the vector1 [x...
asked by 05.02.2018 / 13:01
1
answer

Print elements of an array in C ++

I am trying to print the elements of the fruit array inside a for , but the code is not working. Where am I going wrong? int main() { char frutas[20][4] = { "Açaí", "Acerola",...
asked by 04.02.2018 / 18:07
1
answer

TCP server with select () does not work because printf shows 3x msg and msg comes with garbage at the end and it finishes automatically

void cria_server_tcp(int porto) { struct sockaddr_in serveraddr, clientaddr; int fd_listen = cria_socket_tcp(); int max_clientes = 20; //numero maximo de clientes em espera int addrlen; int *memset_r; int bind_r; int l...
asked by 30.03.2018 / 01:15
1
answer

Chained List (insertion at the end)

I'm trying to make a linked list with insert at the end of it, but at the time of writing the error and I do not know what the problem is. #include <stdio.h> #include <stdlib.h> struct cel { int v; struct cel *prox; }; typ...
asked by 06.02.2018 / 23:50
1
answer

Difficulties in making the g2 library work in C code

I have this code in which the following errors appear in the terminal, and the goal is to be shown with the g2 library: codigocanvas.c: In function ‘world_canvas_new’: codigocanvas.c:22:33: error: expected identifier before ‘(’ token *d...
asked by 29.01.2018 / 17:20