Questions tagged as 'ponteiro'

1
answer

How to implement a copy constructor for a two-dimensional array in C ++?

I have the following situation: a Matriz class implemented as follows: Header: #ifndef MATRIZ_H #define MATRIZ_H class Matriz { public: Matriz(unsigned int nL, unsigned int nC); ~Matriz(); Matriz& ope...
asked by 29.09.2017 / 17:30
2
answers

Problem with recursion and pointers

I'm having trouble solving the following question:    Make a recursive function that allows you to sum the even elements of a vector of integers, you must use pointers to traverse the vector My code is not performing the correct calculati...
asked by 16.10.2017 / 16:54
1
answer

Error: incompatible types when assigning to type 'char [200]' from type 'char'

When I try to insert char motorista , an error appears:    [Error] Incompatible types when assigning to type 'char [200]' from   type 'char' Code: #include <stdio.h> #include <stdlib.h> #include <locale.h> typed...
asked by 03.03.2017 / 15:24
1
answer

Allocating text dynamically, and error in free ()

I'm trying to allocate dynamically, but the error is appearing:    Error in ./name.c; invalid pointer: 0x0000000001c18834 My code: // FUNCAO // char *nome(text[]) { int n3 = 0; int n2 = 0; char *n = NULL;...
asked by 19.06.2017 / 22:00
1
answer

Struct with vector is not working

I'm trying to use vectors and struct , but it's not working. #include <stdio.h> #include <stdlib.h> typedef struct Atleta { float notas[5]; } atleta; void receberNotas(atleta* l) { int i; for(i=0; i<5; i...
asked by 28.09.2016 / 00:59
3
answers

Doubt regarding pointers in C

void imprime (char *v, int n) { char *c; for (c = v; c < v + n; v++) printf ("%c", *c); } I have this function, but I do not understand what it is doing exactly and how the pointers behave in this case.     
asked by 28.09.2016 / 21:46
1
answer

Why can not I change the string this way?

When we have an int variable declared, and then a pointer to that variable: int x = 10; int *p = &x; To modify the variable x through the pointer, we have to do: *p = 20; However, when I declare: char *string = "ABCD"; And I t...
asked by 08.12.2015 / 17:21
1
answer

Use of pointers

I need to use pointers, but I do not understand how to express the syntax, it is part of the purpose of the task (change the value of the parameters passed by reference to the functions, such that these variables are printed in main ()). > #in...
asked by 16.11.2015 / 02:50
2
answers

How do I access the pointer of a struct within the pointer of another struct?

typedef struct vertice { int num_vertice; int profundidade; struct vertice **vertices_adja; } Vertice; typedef struct grafo { int qtd_vertices; int *Vertice; } Grafo; I want to access the attributes of the...
asked by 06.10.2015 / 16:07
1
answer

Stack operations

I am trying to do operations using stack but at the time of allocating the results in the previous position in the stack it is that I am not succeeding because the result of the operation is not allocated in the desired position: I'm trying t...
asked by 05.11.2018 / 01:56