Questions tagged as 'c'

3
answers

When to use const and when to use #define

Since the two do the same function is there any difference between one and the other? I'll take the code from this site as an example C - Constants & Literals The #define Preprocessor #include <stdio.h> #define LENGTH 10...
asked by 22.06.2016 / 15:51
3
answers

Typecast of malloc is recommended?

I have already read that it is not recommended to do typecast of malloc when allocating memory for a new pointer variable, and a lot of sites and books teach this practice in memory allocation, left with some doubts. Why is it not r...
asked by 13.04.2016 / 20:43
2
answers

How to organize the code without losing performance?

Using functions instead of putting the code directly influences the performance of a program? For example: void minhafuncao(){ printf("Funcao"); } main(){ minhafuncao(); } instead of main(){ printf("Funcao"); } I know macros have...
asked by 09.04.2015 / 17:45
3
answers

Reverse a 3-digit number in C

I need to make a program that the user type a three-digit number and the program reverses that number for example 123 -> 321 , I would like to know the logic to do this, because I can not think of anything.     
asked by 15.10.2014 / 19:48
4
answers

César's cipher - problem with letters and spaces

I'm doing an exercise on the cesar figure below: #include<stdio.h>#include<string.h>main(){charfrase[200];printf("String: "); gets(frase); for(int i=0; i < strlen(frase); i++){ if(frase[i] == 'x') frase[i] = 'A';...
asked by 20.06.2017 / 04:21
4
answers

Copy from txt file to the other

int main(void) { void copiaConteudo(FILE *arquivo, FILE *arquivo1); FILE *arquivo = fopen("tmp/exercicio.txt","r"); if (arquivo == NULL) { printf ("Não foi possível abrir o arquivo"); return 1; } FILE *arq...
asked by 31.08.2017 / 21:50
3
answers

Working with OCR to recognize photos

I am currently working on my Course Completion Work and the subject involves OCR. I did some research and found the Tesseract , I also found libraries in Nuget for it (I'm using C #). The problem is that my work is about reading Car Plate, when...
asked by 28.08.2014 / 13:54
2
answers

Array is a pointer in C? [duplicate]

I'm reading a book about pointers in C, but since I'm new to such a language, the concept of pointers is a bit complex, and when I read the following definition, I came up with the question of whether an array is a pointer .    Pointer Var...
asked by 03.07.2017 / 15:18
2
answers

What does the expression "a + t" mean in the second parameter of fopen in C?

I was encountering a code here and I was curious about this passage: FILE *fp = fopen("Agenda.txt","a+t"); What is "a+t" ?     
asked by 19.05.2017 / 05:25
1
answer

Rounding in C

I would like to know how I could ignore rounding in divisions, for example:    4/3 = 1.33 ... ~ 1 | 5/3 = 1.66 ... ~ 2 Right? I wanted to make a program in C, that in these cases, rounding is not done, because the idea is to increment...
asked by 20.07.2015 / 15:42