Posts by ViniciusArruda • 549 points
10 posts
-
11
votes2
answers2240
viewsQ: How does C99 work in relation to C90 for declaring variables in the middle of the code?
At C90 and C89 we have to loop for must have its variable declared earlier at the beginning of the function scope, example: void main (void) { int i; for(i = 0; i < 10; i++) { /* Qualquer coisa…
-
2
votes1
answer725
viewsQ: Is using %(limit)[ n] in scanf safe to capture strings?
I would like to know a totally safe way to capture strings without running the risk of buffer overflow or any other threat. I read a lot about ready-made functions and would like to know which ones…
-
2
votes1
answer909
viewsQ: How does buffer work using printf and scanf?
Using the printf, when I do: printf("\n\tQualquer coisa\n"); It inserts this first into a buffer and then prints to the screen (standard output) ? Using the scanf format %c, it captures from buffer…
-
5
votes2
answers295
viewsQ: Why did a dynamic array work without the use of malloc()?
Follow the code passage below: int main(void) { int tam, vet[tam]; printf("\ndigite tam: "); scanf("%d", &tam); return 0; } I didn’t know this worked, because I’m typing the vector size at…
-
2
votes3
answers476
viewsQ: How to see the implementation of a function?
From time to time I have some doubts about the efficiency of a code and I think that if I see the implementation of a function I am using I can know how efficient it is or not. Some examples of…
casked ViniciusArruda 549 -
4
votes1
answer69
viewsQ: How is an integer pointer variable stored?
When we declare : int* x; How the compiler compiles this and how the computer (it would be better to say operating system because it manages memory) performs this ? I mean, the O.R. reserves a space…
casked ViniciusArruda 549 -
1
votes2
answers84
viewsQ: How does the compiler work in the case of a casting like this?
Having the code to follow: 0 #include<stdio.h> 1 2 int 3 main(void) 4 { 5 int x; 6 x = -3; 7 8 for (int i = 0; i < 5; i++) 9 { 10 printf("%d\n", (unsigned int) (x - i)); //necessita mesmo…
-
3
votes2
answers93
viewsQ: What is the difference between these expressions?
In the srand’s handbook man srand says srand has as a parameter a unsigned int, but when using without cast the compiler does not complain. It has some possibility of going wrong if not using with…
-
6
votes1
answer347
viewsQ: interpretation of quicksort
I learned Haskell, and now I’m starting to learn C. I’ve been trying to pass my quicksort code in Haskell to C but I haven’t succeeded. So I decided to look at some books and found the following…
-
7
votes1
answer3034
viewsQ: How to email in C?
I searched several sites and google, but there’s always something with PHP or HTML. How to send an email using only C?