Questions tagged as 'c'

1
answer

Use of arrow keys to generate movement in game

I wanted to know how the developer of the Snake game in C ++ merged with C made the snake move from the keyboard arrows. I think the part it moves on is the time that compares tecla=='K' tecla=='H' and so on, but I wanted to know wh...
asked by 14.01.2017 / 06:00
2
answers

Check the diagonal of a specific index

I wanted to know how to check the diagonal of a particular index, for example, put 1 in all diagonal numbers of row 2, column 2 0 1 0 1 0 0 1 0 0 1 0 1 1 0 0 0     
asked by 11.12.2015 / 15:27
2
answers

Error with Near and Far pointers in C code

Error compiling C code with Near and Far pointers #include <stdio.h> void main(void) { char *titulo_near = "Bíblia do Programador C/C++, do Jamsa!"; char far *titulo_far = "Bíblia do Programador C/C++, do Jamsa!"; printf("...
asked by 22.09.2017 / 11:19
2
answers

What does the expression "! (errS & errE)" in the if?

In a part of a code that I need to understand, a new syntax appeared for me in if : if (!(errS&errE)) { fprintf(stderr, "\nFALTA ARGUMENTOS\n"); if(!errS) fprintf(stderr, "-s NOME ARQUIVO SAIDA \n"); if(!errE)...
asked by 04.04.2018 / 08:47
1
answer

Percentage calculation in C

   "Encode, compile, and run a C program that receives the   base salary of an employee, calculate and show the salary to receive,   knowing that this employee has a 5% bonus on the   base salary, and pay 7% tax on base salary. " #include <...
asked by 04.05.2016 / 05:19
1
answer

Doubts about pointers and dynamic allocation

I'm having a hard time doing this activity. If possible, give me tips and solutions to improve the code. And explain to me why the compiler is able to run the program but when it gets to the end of the option it registers the error. Anyone who c...
asked by 15.06.2018 / 03:06
1
answer

How to detect the mouse in the terminal

I would like to know if there is any way to detect the mouse in C, such as when entering the terminal's quick edit mode.     
asked by 03.09.2016 / 01:34
1
answer

Pick up all text from a typed line

I'm creating an algorithm in C to train myself and I need to get a text (large and with spaces) that the user types at the same prompt. I've tried using scanf, gets and fgets and none is catching what comes after the space, just the text until y...
asked by 03.07.2017 / 21:11
5
answers

"else" error without previous if

I'm trying to fix and always err in the same place, always with if and else or between them. The problem always occurs with other codes. #include <stdio.h> #include <stdlib.h> int main () { float a, b, c, deslta,...
asked by 03.04.2014 / 22:09
3
answers

Conversion from C to Java

Consider a method that takes 2 parameters and does a calculation to generate a check digit. Here is the snippet of code I'm having trouble with: char metodoDigito(char num, char qtos) { short soma, peso, remainder; while(...
asked by 24.09.2018 / 19:06