Questions tagged as 'c'

1
answer

How can I add the value of the result to the previous value?

I would like to know, how do I add the value of the sequence in the variable res and then print it? for example, enter the value of N equal to 2 and get the value 2.5 in the output? #include <stdio.h> int main (void) {...
asked by 02.05.2015 / 02:24
1
answer

C Portability on Linux

I'm starting to use Compilr and there they use Linux. I'm having some problems like for example printing a text file. Look at my program, it works on windows: #include<stdio.h> /* escreva um programa que leia o nome de 10 pessoas e arm...
asked by 28.10.2014 / 12:03
2
answers

Segmentation Fault in array of Structs C

I'm trying to make an array of dynamic structs in C, however I'm not understanding why it's returning me segmentation fault. The code is basically this: I'm just creating a vector of 10 arrays and then trying to initialize each struct indi...
asked by 09.10.2014 / 14:49
2
answers

Making cmd slower

Is there any command for cmd to run a program that I run from the compiler? I would like to Debug what I did, and as I often fall into an infinite loop, I want to know if I can do cmd run slower (much slower) so I can see at what p...
asked by 14.06.2015 / 01:13
1
answer

multiplication of matrices with minimum of each row

Hello, I made a program with the intention of multiplying each element of each row of an array by its highest value element, but my program multiplies each one by itself #include <stdio.h> #include <stdlib.h> #include <locale.h&...
asked by 09.08.2014 / 22:38
2
answers

factorization with loops

I am writing the book 6º edition of C as a program of the Deitel brothers and I am in doubt in an exercise, the exercise is 4.14 of chapter 4 that is about factorization, it asks a program that the user type a number and that number is factored,...
asked by 02.07.2014 / 20:12
1
answer

String with memory garbage

I have some problems when working with files and functions, the code I'm doing should print a string in the file, but that string is garbage, and does not print which should in spite of being used normally. link #include <stdio.h&g...
asked by 15.10.2014 / 13:45
2
answers

Mallocation fault in malloc () function

I'm having a segmentation fault when I have implemented a dynamic array of pointers to be able to store the contents of a file line-by-line. size_t file_mem_init(char ***ptr,FILE * file){ size_t mem_size = getnline(file); // retorna a quan...
asked by 19.09.2014 / 01:59
2
answers

Average calculation problem between int and float

I have a problem with a mean calculation. I have a struct with 3 fields. The ones I'm wanting to average are quantity of products and unit value. I need to average between all products and their prices. However, when I have unit values with 0...
asked by 11.05.2014 / 00:17
1
answer

Insert - Jump Lists / Skip Lists

I'm trying to implement the insertion algorithm of a node in a jumps list , but I'm not making progress with the solution because I do not know at what point is that I should add the node. So far I've done this algorithm: void i...
asked by 30.03.2014 / 03:06