Posts by Rubio Terra • 104 points
6 posts
-
-1
votes5
answers5371
viewsA: Split a string with empty spaces
I suppose the problem is the empty fields, that the strtok() does not recognize. On Linux, we have the function strsep(), which was created precisely to resolve the limitation of strtok(): #include…
-
5
votes3
answers871
viewsA: Polymorphism in C
A form of "polymorphism" widely used in C programs is using function pointers, as has already been commented. You will find this kind of implementation in the Linux kernel, Openssl, etc. Look at an…
-
0
votes1
answer162
viewsA: Runtime error in C
The problem is that you are passing a copy of the array to the function inicializar(). The copy is modified correctly within the function, but the original variable remains with the original values,…
-
0
votes2
answers336
viewsA: Width Search - error: 'str_no' undeclared (first use in this Function)
There are several errors in your program: |17|error: array type has incomplete element type| The error is on the line: struct str_no fila[tamanho]; The first error is that you have not declared the…
-
0
votes1
answer49
viewsA: Integer Overflow with PID in C
An idea would be to create a loop by making Fork(). Something like: #include <limits.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> ... int p; for (p =…
canswered Rubio Terra 104 -
1
votes1
answer232
viewsA: fread and structure memory allocation
The problem is that you are reading the entire file to calculate the size. Before reading it again to the structure, you need to make a fseek() to get back to the beginning. There are more efficient…