Questions tagged as 'c'

2
answers

return string in a function

eg income 20weight, and 1.80 height, you get imc < 18.50. and I want to return the assigned string in overweight in the function. to say in console, 'You are overweight'. #include <stdio.h> char calculoimc(float peso, float altura) {...
asked by 03.04.2018 / 23:06
3
answers

Strcpy in C with pointers

I'm creating a function in C that copies the string s2 in s1 but it does not work and I do not know where my fault is. My code is as follows: char* mi_strcpy(char* s1, char* s2){ char* puntero = (char*) malloc (mi_strlen(s...
asked by 23.02.2017 / 09:49
1
answer

Huffman Algorithm - decoder

I'm doing the decoding part of the huffman algorithm, as such my program receives two files per console, one called "diccionariotxt" which contains the letters, the frequency with which they exit and the binary code of each letter and another on...
asked by 25.06.2016 / 04:55
1
answer

c - Memory leak in realloc

I've had a memory leak in a realloc for two days and I can not find the problem. Here I attach the code: #include "palabra.h" Palabra * palabraNueva(){ Palabra* pal = NULL; pal = (Palabra*)malloc(sizeof(Palabra)); if(pal...
asked by 07.10.2018 / 10:58
1
answer

Prevent letters from being run when printing data on screen

For example, in the image depending on the first name (Chuck Norris) he runs me all the way to the side. I'm looking for a way that, independent of the length of the text, the things on the right do not run. printf("*********************...
asked by 22.12.2018 / 20:42
1
answer

Show number of numerators = 3 in a struct

I have the following program in C the user enters numerators and denominators in an integer struct and the number of numerators with value "3" must be displayed: #include <iostream> #include <stdio.h> #include <stdlib.h>...
asked by 10.07.2018 / 08:11
1
answer

Why do you round my decimals? Problem with two-dimensional arrangement C

I am starting in the art of programming, and I am working on an exercise to show the inverse of a matrix. The inverse matrix is defined as a double array, and I am using the algorithm for cofactors. The problem is when I show the matrix on the...
asked by 30.07.2018 / 00:24
1
answer

Creating my "mini shell" - Error: Segmentation Fault

I am developing a mini shell for a university practice and I run into an error that I have not been able to solve since according to what I have understood, searching in Google for my error, it is an error that can come out of several causes. Le...
asked by 09.11.2016 / 14:50
1
answer

C Error: Dereferencing pointer to incomplete type

Good, I am stuck with the error of the matter. I'm trying a simple code, but I do not realize where the error is. The Error is in the printf struct nodoLinea { char Caracter; struct nodoLinea *Siguiente; }; typedef struct nodoLin...
asked by 07.11.2016 / 19:35
1
answer

How to pass the entered data of a structure to upper case

I want the data entered from the "Books" structure to be directly capitalized. I know we have to use the toupper () function but I do not know how to apply it when I work with structures. #include<stdio.h> #include<string.h> #inclu...
asked by 14.11.2016 / 13:27