Questions tagged as 'c'

3
answers

Decimal to octal conversion

I need to create an algorithm that converts decimal to octal, but my conversion is wrong, can anyone help me how would it be right? #include <stdio.h> int decim(int n) { int i,a; int octal; if(n<=7)...
asked by 27.05.2018 / 01:06
1
answer

What's wrong with double variable

I need to make an algorithm that the user informs two values and return the largest between them using double, but at the time of compiling it from the error pointing something in the double but I do not know how to solve, someone can help me an...
asked by 29.05.2018 / 23:18
3
answers

Temperature converter

When I type the temperature in Fahrenheint the program returns 0 as a result, where is the error? #include <cstdlib> #include <iostream> #include <conio.h> #include <string.h> #include <math.h> using...
asked by 26.02.2018 / 14:27
4
answers

How to use switch in C?

I have to understand this code that my advisor passed to me. How much% of% after opt is required? The command switch too? Why does not it appear after the options break and case '?' ? if( argc <= 1) { fp...
asked by 13.03.2018 / 19:26
2
answers

Doubts cast in c

If I give a printf like this: int x=5, *px = &x; printf("%d %ld\n", x, (long)px); Until then without Warning , but if you change the printf : int x=5, *px = &x; printf("%d %d\n", x, (int)px); I get a warning:  ...
asked by 05.01.2018 / 21:04
2
answers

File In C language

I have a file In this format: link (link to download the file read); [105][32][55][10][32][32][32][32][32][32][32][32][32][32][32][32][32][32][32][32][32][82][101][108][101][97][115][101]... I need to read the data in this format: 10...
asked by 21.11.2017 / 22:34
1
answer

Why can not I access the data of this struct with the dot, only with the arrow?

I have alloted this struct by dynamic allocation and can only access the data idade via arrow and not by point wanted to know why? #include<stdio.h> #include <stdlib.h> struct pessoa { int idade; }; void alteraId...
asked by 21.12.2018 / 23:19
1
answer

Always output the same in C

I wonder why the last printf of my program is always the same? I made it in C and I'm a beginner. The purpose of the program is to verify that a is palindrome or not. But when it comes time to print the result, in every run of the program...
asked by 20.12.2018 / 20:38
1
answer

Error accessing string vector

I have the following code: #include <stdio.h> #include<stdlib.h> #include<string.h> int main() { char v[]= {'Brasil', 'Alemanha', Japão'}; int i = 0; for (i=0; i<4; i++){ printf("%s", v[i]); } } Ho...
asked by 30.10.2016 / 01:23
2
answers

Problem with Struct and Function in C

Good evening, I have a problem with the code I'm doing. I'm not sure if I'm deleting the values correctly (and replacing the next). The error is appearing in the substitution by the next and I do not know if I'm correctly passing the x, which is...
asked by 30.09.2016 / 22:52