Questions tagged as 'c'

1
answer

I can not find the indexes of the largest number

I'm doing a program that needs to know the indexes of the largest values in the vector, but I'm not getting the code I tried. #include <stdio.h> int main(int argc, char** argv) { double vetor[10]; int indice[10], c = 0; for(int i...
asked by 06.04.2018 / 21:28
1
answer

Calculating mean while sequence

I'm solving college exercises, but I caught myself in one: The exercise asks me to calculate the even numbers between two integers, and in the end, I do the arithmetic mean between the pairs. What I've done so far: int main() { int n...
asked by 06.04.2018 / 18:36
2
answers

How do I return only the largest value within a vector?

   It does not correctly check the largest. For each animal it shows the weight of the animal as the largest. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #define TAM_MIN 1 #define TAM...
asked by 30.03.2018 / 19:45
0
answers

Redirecting files to C files

Hello, I have a question to implement piping in this code. I'm trying to implement the commands: cat / etc / passwd > my_file_1 grep home < my_file_1 > my_file_2 wc -l < my_file_2 #include <stdio.h> #include <unistd....
asked by 30.03.2018 / 22:23
0
answers

What is the reason for a runtime error in this code?

I have an exercise to do and I submit it to an automatic corrector (Sharif), in my tests all the cases work, but in the broker I am getting a Runtime Error, I have already reviewed this code many times and I do not think the error. (Exaggerated...
asked by 30.03.2018 / 15:51
1
answer

System call dup2 vs. write & read

I'm wondering why in some cases there are examples of conversations in the parent process and the child process - obtained through the fork () system call - that use the read and write functions and in other cases use the dup2.I am trying to cre...
asked by 09.04.2018 / 15:42
1
answer

Why does the leValidaText function return garbage?

   I'm trying to validate the car's board, but I can not. I tried using scanf instead of fgets and nothing. I have no idea what might be causing the problem. #include <stdio.h> #include <stdlib.h> #include <string.h> #inclu...
asked by 08.04.2018 / 20:57
1
answer

How to pass the registration code as a function parameter?

I have to sort the salaries of a company's employees in a decreasing way. Entry, Enrollment, salary if you want to continue Exit: Salaries in descending order. The error that is appearing is the following:    [Warning] passing argum...
asked by 28.03.2018 / 22:14
2
answers

Algorithm problems in C

Does anyone know why the program simply closes when I type O ? #include <stdio.h> #include <locale.h> //Biblioteca locale é uitlizada para definar o idioma do programa. int main() { setlocale(LC_ALL,"Portuguese"); //Comando u...
asked by 05.04.2018 / 00:16
1
answer

How to omit space to enter only numbers in different lists

#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct NBIG{ int numero; struct NBIG *nseg; struct NBIG *nant; }Nbig; int main(int argc,char *argv[]) { char *nf,ch; Nbig *vem=NULL,*resm...
asked by 05.04.2018 / 10:29