Questions tagged as 'c'

2
answers

how to compare null / null value when I type character in C

printf("\nteste -> "); scanf("%i", &opAjuda); / * opHelp is to receive an integer, but I want to do an if here,  saying that if the person writes a character rather than integer, it goes to the help screen and shows the message...
asked by 31.10.2015 / 17:05
1
answer

A comparison between 2 char (s) is wrong

I am manipulating a string with a loop for... that generates a new string of it, starting and ending of a certain position (would be "Hello" in that case). > When I compare the return of the manipulation with another string con...
asked by 15.05.2016 / 15:56
2
answers

Why the result of this code in C of 55?

I wanted to know why the result of this code is 55, I'm reading the book and I did not understand it, I compiled it in codeblocks. #include <stdio.h> #include <stdlib.h> int main() { int i, soma = 0; for(i=1;i<=10;i++)...
asked by 13.05.2015 / 05:06
1
answer

Changing array of integers for image filter

I'm doing a program that applies filters to images .ppm , images without any encoding, the problem is that when I apply the filters, the original image is not changing, where is my error? The same thing is happening for the other filters...
asked by 11.11.2014 / 14:02
1
answer

Variable loses value in C

The code below has the expected behavior in case the values are entered correctly. But, when I am reporting, for example, in the following order: preco equal to 1 , quantidade equal to -1 , then quantidade equal to 3 , th...
asked by 13.03.2015 / 11:45
1
answer

Open a file using secondary function

I need to create a function that "points" a file pointer to a particular file in the computer's memory. I was able to do this: #include <stdio.h> void abre(FILE*); void procedimento(); int main () { procedimento(); return 0; }...
asked by 02.09.2015 / 15:49
1
answer

Double with maximum precision of 40 digits [duplicate]

I need my program to return a high value of digits in the house with a maximum of 40 digits. I've seen that the type DOUBLE has a range from 1.7 x 10 ^ -308 to 1.7X10 ^ 308 , so I should think that it caters to my needs too much....
asked by 28.10.2014 / 17:47
2
answers

Sum of squares

I've been doing a function to calculate the sum of the first number (x0) with the ratio (r) by multiplying by a number (n) of times, like this function: double sum_arithmetic(double x0, double r, int n) { return n == 0 ? 0 : x0 + sum_arithm...
asked by 29.09.2014 / 00:46
1
answer

Problem with float vector

I created a code for a college exercise that was running right, but I forgot that one of the variables of struct was a vector, and when I made a simple change everything changed. Virtually all functions are giving error. I do not find the...
asked by 19.06.2015 / 05:41
2
answers

Problem with Struct in C

In this code: #include <stdio.h> #include <stdlib.h> //Usando o struct(Estruturas) struct cadastro { char nome[50]; int idade; char rua[50]; int numero; }; int main() { printf("Digite suas informacaoes...
asked by 18.05.2015 / 02:45