Questions tagged as 'ponteiro'

1
answer

Allocate memory with pointer or reference?

Are there any significant differences between these two methods? MyClass &ref = (*(new MyClass)); MyClass *ptr = (new MyClass);     
asked by 11.09.2018 / 12:17
1
answer

How do I resolve struct declaration warning?

I'll send the code and warnings that GCC is reporting. Should I ignore the warnings? warnings are related as passing from struct to function Inserir(); : #include <stdio.h> #include <stdlib.h> int menu(); int...
asked by 21.09.2017 / 17:01
1
answer

Pointers in college

I am studying pointers and this is code used as an example that is in the material given by the faculty. I have been replicating this code in my machine and the output is different from the one presented in the material. Code: #include <std...
asked by 29.10.2017 / 00:08
1
answer

Vector of char by reference

I'm trying to pass a array from char to a procedure that will resize (with malloc() ), write its contents and return to main() . I know that every vector is a pointer and is already passed by reference, but something in...
asked by 01.11.2017 / 18:03
1
answer

Doubt with C pointers

I have a linked list, with a single variable that is the date (int). I made this function to delete by value. lista *head = NULL; void deletar(int valor) { lista *prev, *temp = head; if(temp->data == valor) { head = temp-&...
asked by 23.05.2017 / 18:16
1
answer

Allocation and memory cleaning in C - how much should I care?

I am learning C from the book "Use the Head! C" (condemn me). Given a lesson, I need to create a struct called " island " with the following code: typedef struct island { const char *name; const char *opens; const char *clos...
asked by 03.11.2015 / 00:18
1
answer

Is this bubble sort correct?

People are reading C ++'s "Programming principles and practice using c ++ (2nd edition)" book. You have a good exercise at the beginning talking to make a program that orders the given numbers. I did it using BubbleSort, I burned a lot of neuron...
asked by 09.07.2015 / 19:13
1
answer

Query vector from one table to update another in C

Hello. I'm new here and I do not even know if I was very objective in the title. But let's go. I'm almost finishing my final C Algorithm project, and I'm not able to update an item from one table with information from another. More specific:...
asked by 05.06.2015 / 02:58
1
answer

What does the error mean: realloc (): invalid pointer: 0xb78094d8?

My program, whose code is below, has the following error: I do not understand why, I have plenty of memory in my PC, and all compiler sites have the same problem. ***Errorin'./prog':realloc():invalidpointer:0xb78094d8***=======Backtrace:==...
asked by 30.10.2014 / 08:56
1
answer

Error printing member of struct: request for member in something not a structure or union

I have the following struct : typedef struct{ int Numerador ; int Denominador ; } TNumeroRacional ; In this function I ask the user to enter 2 numerators and denominators to form 2 rational numbers. void Atribuir (TNumeroRac...
asked by 02.09.2018 / 00:04