Questions tagged as 'c'

1
answer

fread and structure memory allocation

I have the following structure: typedef struct registro {//52 bytes char codigo[4]; char descricao[31]; char unidade[3]; int quantidade; float valor; char status; }registro; It should store the values of a dados...
asked by 31.10.2016 / 01:37
1
answer

Error when debugging program: "No symbol table loaded"

When debugging the program the following error message appears:    Debugger name and version: GNU gdb (GDB) 7.10.1   Starting the debuggee failed: No symbol table loaded. Use the "file" command.   Debugger finished with status 0 This pr...
asked by 24.12.2016 / 22:21
1
answer

Know when a file line starts with a given string

I have a file like this: # Blender v2.69 (sub 0) OBJ File: 'CUBO.blend' # www.blender.org mtllib cube.mtl o Cube.022_Cube.030 v 0.450000 -1.450000 0.550000 v 0.450000 -1.450000 1.450000 v -0.450000 -1.450000 1.450000 v -0.449999 -1.450000 0.55...
asked by 09.11.2016 / 16:06
1
answer

Read text file picking float numbers and playing in array

I have a text file for example with: v 1.000000 -1.000000 -1.000000 v 1.000000 -1.000000 1.000000 v -1.000000 -1.000000 1.000000 v -1.000000 -1.000000 -1.000000 v 1.000000 1.000000 -0.999999 v 0.999999 1.000000 1.000001 v -1.000000 1.000000 1....
asked by 09.11.2016 / 04:23
1
answer

Know how many positions were filled in a vector in C

I can not display the filled positions in C. I need to get back which positions are missing to be filled and those that are filled. ex: "So far there are 3 registered students, thus allowing the insertion of a maximum of 7 more students." #...
asked by 09.11.2016 / 19:43
1
answer

Segmentation Fault (Core Dumped) Print Numbers

I wrote an algorithm that prints all integers in a closed range from A to B, with A and B integers. However, when compiling and mounting the file in linux bash, a "segmentation fault" occurred. Can anyone explain me why? #include <stdio.h&g...
asked by 10.11.2016 / 18:37
1
answer

Simple While Cycles

#include <stdio.h> main(){ int cont=15; while(cont<=200){ printf("%d\n",&cont); cont++; } } Supposedly the counter should start with value 15 and go showing its value by adding 1 at the end of ea...
asked by 20.11.2016 / 13:33
1
answer

Error in capturing information in files using the fseek () function ... What is the problem?

I'm having trouble with an info capture function from a file with the fseek () function [I do not know if there is a better alternative ...]. Returning to the problem, I want to read a file that has: "2165327575 R" "7625621 W" and so on ......
asked by 21.11.2016 / 13:06
1
answer

Battery usage and passage by reference

Hello, I'm doing a program where I have a stack and want to reorganize the elements of it. I created a function that does this only if the original stack is not being modified (it is only modified in the function but is not modified in memory)....
asked by 08.10.2016 / 22:28
1
answer

What is the purpose of incrementing a pointer?

Given: #include <stdio.h> int main () { int x = 1; x++; int *y = &x; y = y + 1; printf("%d\n",x ); } The output is 2. In this case, I would like to know if the following interpretation is correct: y = y...
asked by 25.10.2016 / 00:36