Questions tagged as 'c'

2
answers

Doubt in Struct + C pointer

Given the code below, I wonder why the second printF of the LeAluno procedure does not print correctly? #define MAX 3 typedef struct aluno{ int matricula; float notas[2]; } Aluno ; int t=1; void LeAluno(Aluno *Param){// com ponteiro...
asked by 29.07.2014 / 20:01
1
answer

Doubt in strcmp

I'm in doubt on a line of code: if(strcmp(novo->nome,aux->nome)>=0) How does your comparison work? Being that the name is a char!     
asked by 09.06.2014 / 18:42
3
answers

Using Struct in C language exercise

/ * Write an algorithm that reads data from "N" people (name, sex, age and health) and whether or not you are fit to perform compulsory military service. Enter the totals. * / #include <stdio.h> #include <stdlib.h> struct Pessoa {...
asked by 15.03.2014 / 15:07
3
answers

Removal of cells at the beginning of a list

I have this problem of removing an element from the beginning of a list, even doing the schematic in the drawing I could not. The strange thing is that it works with up to 3 elements, from the 4 cmd (which to using gcc to compile) to respond. An...
asked by 01.03.2014 / 19:03
1
answer

Use% (limit) [^ \ n] in scanf is it safe to capture strings?

I'd like to know a totally secure way of capturing strings without running buffer overflow or any other threat. I read a lot about ready-made functions and would like to know which are the most recommended, but I wanted to be able to impleme...
asked by 07.11.2014 / 14:01
2
answers

Invert "string"

I have the following function: void InverterString(char *str1){ char aux[strlen(str1)]; for (int c=0; c<5; c++) aux[c] = str1[4 - c]; printf("A string1 invertida fica: %s", aux); } However, it prints the phrase that is in...
asked by 24.08.2018 / 20:50
2
answers

C - Remove item from result

How do I remove 0.00000 prints in the response of this program after the idealBrutus and idealOlivia functions are called in the main function? I noticed that if, for example, you change line 59 from the original to: pr...
asked by 19.08.2018 / 01:17
2
answers

Error removing stack item

What is the error of the function pop ?? void pop(Pilha *pilha){ if(pilha->size == 0){ puts("pilha vazia"); } else { printf("item removido: %d\n\n", pilha->itens[--pilha->size]); free(pilha->itens[--pilha->...
asked by 27.02.2014 / 03:00
1
answer

Why when I include my .h header, is the .c implementation not included too?

I have three files, produtos.h , produtos.c and main.c . produtos.h is located in the "headers" folder, produtos.c is located in "sources" and main.c is in the same folder as "headers" and "sources", some...
asked by 08.10.2018 / 17:23
1
answer

gcc is not found when the Makefile is executed by Travis-CI

I have a C project in GitHub and I'm trying to build it with Travis-CI, but the following error is always displayed: Using worker: worker-linux-9-2.bb.travis-ci.org:travis-linux-2 $ export CC=gcc git.1 $ git clone --depth=50 --branch=someDevs...
asked by 15.02.2014 / 19:03