Questions tagged as 'c'

2
answers

Variable static and #define

What is the difference between defining a static variable and using #define in C? Apparently the two have the same function, right?     
asked by 10.11.2016 / 21:47
1
answer

How to access the hardware in Linux in C?

I know of the existence of the Microsoft Win32 API, which allows the programmer to manipulate low-level resources such as serial ports, memories, CPU, GPU, etc. However, I work with Linux environments, and would like to know how to access the ha...
asked by 08.01.2016 / 17:06
2
answers

How do I generate random numbers and without repeating them in a time interval?

I'm creating a 'game' in which the user needs to choose a range, and in this interval, he chooses how many random numbers he wants to generate. However, in random numbers generated, there can be no repetitions, for example: Range 1 to 10, show...
asked by 29.11.2015 / 19:38
1
answer

If C / C ++ are native languages then why do they need runtimes?

Generally the first thing that came to my mind when I heard the term native language, was a program that ran independent of operating system, communicating directly with the hardware, I always developed in debug mode, when I released a releas...
asked by 31.05.2018 / 02:31
1
answer

Difference between [i] + 1 and [i + 1]

I have questions regarding [i] + 1 and [i + 1] , one increa position and the other content, correct? Regarding the (*i)++ notation, is it similar to the two above?     
asked by 15.05.2018 / 15:43
2
answers

Source Codes in Projects

If I have 10 projects in NetBeans, these 10 projects will use a Logging system, this system will contain a Log.h and a Log.c. Since all projects will have to use these two log files to generate logs, I will need to copy the two files for each pr...
asked by 17.06.2015 / 15:44
1
answer

I want to check if the string contains only letters?

#include<stdio.h> #include<stdlib.h> #include<ctype.h> #include<string.h> #define tam 50 main(){ struct cadastro{ char nome[tam]; }; struct cadastro dados; printf("Nome:"); fgets(dados.nome,ta...
asked by 02.04.2018 / 04:14
1
answer

Compensates to store the value of a struct member in local variable?

I see several programmers doing this. Instead of accessing the member of a struct directly, it copies the value to a local variable to the function and uses this variable. Is there performance gain in this? Does it matter if the struct...
asked by 09.02.2017 / 13:34
1
answer

Overwriting the txt file in C

My question is pretty basic: How do I, whenever I save something to a file (txt), always start recording after the information that was already written there? I mean, how do I not overwrite the contents of a file that already had informati...
asked by 03.07.2017 / 01:05
2
answers

Why does not the battery pop?

With this code, the book tells me that this does not pop the stack, but why exactly does it not bang? #include <stdio.h> int main(){ int *p; while(1){ p = new int; } }     
asked by 18.07.2017 / 22:38