Questions tagged as 'c'

2
answers

C - How can I read data from a file (Given that I use structures for it)

Good evening. I am developing a project for the Faculty in C, where I have a data structure to work with data common to "Offenders", or those who have committed an infraction. typedef struct Infractores { int ordemdeEntrada;//ordem de e...
asked by 27.05.2015 / 00:35
1
answer

How does the "pop ()" function work on a stack?

I would like to understand how pop works in stacks. I just put the part that I did not understand, I know that in the pop() function there is also the empty check, but I only put the part that I did not understand. It turns o...
asked by 31.08.2018 / 20:47
2
answers

What is the best to use, scanf or get_s? in c

Having the name 'Maria da silva' as an example: scanf() will just read Maria, get_s() will read it all, correct? I am in doubt about the best one to use, my college professor says that we should clean the buffer for scan...
asked by 28.08.2018 / 21:16
3
answers

Function that calculates the factorial of a number [closed]

int fatorial(int n, int f){ int resultado; while(n>1){ f=1; resultado=(n*f); f=f-1; } return (resultado); } int main(void){ int resultado; int n; int f; printf("Digite o numero a ser fatorado:\n"); scanf("%d", &n); resultado=fatorial(n,f)...
asked by 02.10.2018 / 23:46
1
answer

Binary Tree returning empty in search

In my menu it is not making the correct output in the print. In addition to the search return only empty tree. #include<iostream> #include<string> #include<stdlib.h> #include<stdio.h> using namespace std; typedef int T...
asked by 06.11.2014 / 13:49
2
answers

Dictionary in C always returns "word not found"

I'm having problems with the code below. Although the user types an available word, the return is always palavra nao encontrada . #include <stdio.h> #include <stdbool.h> struct dicionario { char palavra[21]; cha...
asked by 30.08.2014 / 15:52
1
answer

Problems with dynamic array allocation

I'm trying to dynamically allocate an array, however I'm having some problems in runtime and I'm also getting a warning from GCC in < in> compile time . Follow the code below for a better analysis of the problem: #include <time.h&g...
asked by 27.12.2018 / 16:10
1
answer

How to get the same result of strcpy () with strcpy_s ()?

I downloaded a code in C ++ from the internet and when I open the solution, it gives the following error:    Error C4996 'strcpy': This function or variable may be unsafe. Consider   using strcpy_s instead. To disable deprecation, use   _CRT_...
asked by 20.07.2017 / 19:28
2
answers

What does '% 02x' do exactly?

I was seeing some examples of hash functions > from OpenSSL and I came across the format specifier / a> %02x . I do not know very well their purpose we codes that I saw. I even understand that %02x is to fill the field with ze...
asked by 08.07.2018 / 21:07
1
answer

Delete row of a file in C

I'm doing a project for a grocery store. The products are stored in a file line by line like this: code (int) $ name (string) $ quantity (int) $ price (int) $. How can I delete a product (ie, a specific line)?     
asked by 24.04.2017 / 19:10