Questions tagged as 'c'

1
answer

"Compress" values from an array of shorts, to an array of integers

Good evening. I have to work out an evaluation exercise in which I have no idea how to do it. I have to compress 2 consecutive values of an array of shorts, to be stored in an array of integers. This is done until the end of the shorts array. (e...
asked by 06.10.2017 / 22:05
2
answers

Doubt char char C

Hello. I need to make a pointer char point to a memory location that holds a phrase, in C. I'm doing this: char *ptr; char array[3] = {'o','l','a'}; ptr = &array; But I do not understand what's wrong, I also do not know how to...
asked by 09.10.2017 / 22:55
1
answer

Copy list simply chained to C

Hello everyone, I need help copying a list that is simply chained backwards. For example, if the original list is 1- > 2- > 3- > null, it needs to be 3- > 2- > 1- > null. #include <stdio.h> #include <stdlib.h> #in...
asked by 02.09.2017 / 21:49
1
answer

Problems with struch and functions in c

#define FICH "Dados.Dat" /* Ficheiro com os Dados */ #define DIM 30 FILE *fp; /* Variavel Global pois e' util ao longo do prog. */ int cont = 0; typedef struct { char Nome[DIM+1]; char Tipo[DIM+1]; int Ano[DIM+1]; int Tempo[DIM+1];...
asked by 12.01.2018 / 11:13
3
answers

C: Result of delta, x1 and x2 always giving 0.000000

I'm learning C in college, and I'm stuck with this algorithm. I can not find the error. It can tell whether delta is greater or less than zero, but always prints delta, x1 and x2 as 0.000000 /* Name: Bhaskara Date: 10/08/17 19:30...
asked by 11.08.2017 / 17:41
2
answers

Remove first element from a simple chained list

I would like to do a function to remove the first element from a linked list, the way I did it it is only removing the first node and removing the second element. struct lista { int info; struct lista* prox; }; typedef struct lista Lista;...
asked by 12.10.2017 / 09:13
1
answer

ERROR: static declaration of follows non-static declaration

My code is with the following error and I am not seeing and not understanding what it is.    80: 6: Error: static declaration of 'print_menu' follows non-static   declaration void print_menu () {       14: 6: note: previous declaration of 'pr...
asked by 13.09.2017 / 21:00
1
answer

Segmetation fault error - Problem in main code for insertion of binary tree nodes

I'm doing a program that reads records and saves these records in a linked list and in a binary tree. However, I am not able to save the nodes in the binary tree, appearing a segment fault error. I'd like to know why this error appears and...
asked by 24.07.2017 / 01:15
1
answer

Memory allocation - Infinite loop when using free () function

I am making a C code to test Data Structure concepts that are passed in my university. However I came across an error when using the free function, which generates an infinite loop in my code. If I remove it, the code works. I used fre...
asked by 16.06.2017 / 14:29
1
answer

Reading txt file in C and interpreting the data

I need to read txt files in C and interpret the data from within the files. The files contain parts in TEXT and others in DECIMAL / WHOLE numbers. What I need is to read the whole file and pass the numbers to a Cartesian coordinate structure. Fo...
asked by 27.04.2017 / 07:32