Questions tagged as 'c'

3
answers

Crash after reading value with scanf

First, I'm "noob" in programming. I started college today, and the subject was already rolling (third call has its consequences = P). The code is simple, the third one I created, however, after compiling and writing a value, CMD stops working....
asked by 24.02.2014 / 23:14
3
answers

How to check which technologies the CPU supports at runtime?

I'm writing a PC program that has optimized function calls for SSE2 , SSE3 and maybe SSE4 . However, I can not guarantee that the PC that will run the program supports these technologies and would like to check the support so...
asked by 17.03.2014 / 01:07
3
answers

Why does the first element of the vector go out as zero without having saved that value there?

Why does the following code print a 0 at the beginning of output ? #include <stdio.h> #include <limits.h> // Escreva um programa que leia do teclado 8 valores, e em seguida os // imprima em ordem inversa....
asked by 12.10.2018 / 23:20
2
answers

Puts () and Printf (); when and which one to use?

Data entry requests are usually preceded by a text that indicates what you want to receive and usually do not have data to format; my question is this:   If variable data is not being displayed in the request text, why do books and teachers al...
asked by 18.08.2018 / 01:15
2
answers

Why does not the pointer increase the value?

Here was to increment the value of the variable, but it does not work. #include <stdio.h> #include <stdlib.h> int main() { int *p, x = 10; p = &x; *p = (*p)++; printf("%d \n", *p); return 0; } Result:...
asked by 28.07.2016 / 03:46
2
answers

Why does the char * argv [] statement work in the main arg, but not in the code body?

Because when I use the char *argv[] statement in int main(int argc,char *argv[]) it works, but when I try to use it inside the code body with char *argv[]; does it not work? The error below is returned at the console when...
asked by 18.07.2016 / 21:12
1
answer

How to avoid buffer overflow in C / C ++

The program below allows the occurrence of memory overflow, because it is possible to override the variable zero by placing a "large" value in the variable buffer . How to make a secure program by avoiding buffer overflow ? #include <...
asked by 05.08.2016 / 04:04
2
answers

How do I compare a char entry with an interval (0 to 9) without specifying individual conditions?

I'm doing a program that reads a string and I want to ignore the spaces and letters that the user types (but I have to read the letters i and the math symbols + - / * ^). > What I have achieved so far has been to ignore only the spaces. I th...
asked by 10.09.2016 / 16:23
1
answer

What is the correct way to declare a main () function?

In some of the research I've done, I've noticed that there are some different ways of doing it, like the examples below: int main() int main(void) void main() // entre outros... I know that the statements are entirely linked to the retu...
asked by 28.10.2015 / 17:44
1
answer

Should we neglect the return of functions in C that already receive the desired value by the parameter by reference?

Looking at the documentation from scanf() I saw it return a value, but I see the codes using her without making use of this return. Is this right?     
asked by 13.03.2017 / 14:35