Questions tagged as 'c'

2
answers

How do I validate input into c?

My problem is that I have to force the user to enter a single integer value, if he puts anything else (characters or decimals) I should have him type again. I already tried to validate scanf but it did not work. So I did a function to do...
asked by 26.10.2016 / 00:30
2
answers

Vector in C- Program received signal, Segementation fault

Hello, I made a function that checks if a number is present in a vector. THE function receives as parameters the vector, the value to be verified and the number of elements in it. E returns 1 (one) if the element exists in the vector or zero if...
asked by 16.11.2016 / 18:21
1
answer

Calculate distance between two indexes of an array?

I want to get two indexes of the array, and subtract that value. For example, I want to enter index [0, 1] and [2, 10] . And here I want to subtract the value, to calculate the distance between these points. for (int i = 0;...
asked by 28.09.2016 / 18:52
2
answers

Stack does not remove values

Hello, I'm doing a Stack (LIFO) and it does not replace the values by 0 at the time of removing the values from the stack. This was a way I found to "remove" the data from it and the display is shown with the values "1.9". #include <stdio.h...
asked by 06.09.2016 / 15:09
1
answer

How do I use fgets instead of gets?

Before "talking" about my problem, first look at my code and ignore the accentuation errors in the console if it is to execute. #include <stdio.h> #include <stdlib.h> #include <string.h> main(){ char nome[41]; printf("Tex...
asked by 03.09.2016 / 15:17
2
answers

Parameters, functions in C

I'm a beginner in programming and I have a lot of questions regarding functions and parameters. Here is an example code: #include math.h int main(int argc, char *argv[]) // Dúvida nessa linha { double x1, x2, y1, y2, d;...
asked by 13.10.2016 / 00:15
2
answers

Doubt: I did not understand the reason for the continuation

Make a program that receives the age, weight, height, color of the eyes (A - Blue, P - Green, V - Green and C - Brown, L - Blonde and R - Red) of 20 people and calculate and show: * the number of people over 50 years old and weighing less than 6...
asked by 12.10.2016 / 23:51
1
answer

Compilation error -lpthread

I'm trying to compile a .c file, but whenever I call gcc filename.c, I get the following error: c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot find -lpthread collect2.exe: error: ld returned 1 exit status [Finishe...
asked by 01.09.2016 / 18:26
1
answer

Problem with search with Struct

In my code, I can insert and delete normally, but in searches it does not print, what could be the problem? I thought it would work the way I did. Am I doing 'if' correctly? struct fichacarro { char fabricante[15]; char modelo[15]; char combu...
asked by 01.10.2016 / 19:44
1
answer

Error creating child node, generalized list [closed]

The error is in else of method criarFilho , I was able to find it, but I can not find solution for it. Dev-C ++ debug does not say anything. #include <stdio.h> #include <stdlib.h> // #include "decisor....
asked by 16.10.2016 / 23:24