Posts by Marcelo Shiniti Uchimura • 3,302 points
208 posts
-
2
votes1
answer13961
viewsA: Fibonacci sequence in C
Actually, some things were missing: The printf("%d\n", b); should be if (n >= 1) printf("%d\n", b); Before the line above would have to come if (n >= 0) printf("%d\n", a); The for would have…
canswered Marcelo Shiniti Uchimura 3,302 -
0
votes1
answer156
viewsA: How to pass, by reference, a vector of structures to a function?
In function lerDadosArqEntrada(), you have to do printf of the same fields that were used in the fscanf, otherwise the same values will always be printed. That is, if you read from the file to…
-
2
votes1
answer61
viewsA: insert names neatly into a list, I’m not aware of this
I’m guessing there’s a function Aluno* criar(). Try this here: #include <stdio.h> #include <stdlib.h> #define TRUE 1 #define FALSE 0 Aluno* criar(); // prototipo da funcao ja existente…
-
2
votes2
answers377
viewsA: Error to print a C name on the screen using chained list
At the top of the program, do #include <string.h> Then change the contents of Copiarstring to void CopiarString(char* destino, char* origem) { strcpy(destino, origem); } Take off the & of…
-
0
votes1
answer275
viewsA: dynamic reallocation - struct array
There’s nothing wrong with finding trash after the realloc() because this function does not initialize the allocated RAM memory space. If you prefer, see calloc().…
-
0
votes2
answers113
viewsA: Qsort ordering in the wrong way
Pay close attention to RAM memory misalignment after use! free in them! See if this resolves: #include <stdio.h> #include <stdlib.h> #include <string.h> char** palavras; int…
-
0
votes3
answers7818
viewsA: Read multiple scanf numbers separated by space
I couldn’t find a way to pass a vector or a pointer to a vector, to a scanf. See if this way helps you: #include <stdio.h> #include <stdlib.h> void pegaVetor(int* vetor, int qtd) { int…
-
1
votes1
answer1882
viewsA: Concatenation of two chained lists in C
If the lists could have repeated values, simply scan one list and then the other, inserting the elements in the new list. As nay can have repeated elements, you scan one of the lists and each…
canswered Marcelo Shiniti Uchimura 3,302