Questions tagged as 'ponteiro'

2
answers

Pointer function?

statement:    A student's grade is calculated from three grades assigned   between the range of 0 to 10, respectively, to a work of   bi-monthly assessment and final examination. The average   three notes mentioned above obeys the pessos: wor...
asked by 17.08.2018 / 17:00
3
answers

Function with reference passage

I'm trying to make a simple function that counts diamonds, each diamond is given by a pair of '<' and '>'. But I'm trying to do pointers, but it's not giving me the correct result. I followed the "Simple didactics for pointers" , and acco...
asked by 02.01.2015 / 04:51
2
answers

String pointer does not work as expected

I'm trying to print the string pointer below, and if I put " %s " + char* t[]; it gives error, I already put %c it prints the letter " i " I do not know why. I want to learn and not ctrl + c and ctrl Also appeare...
asked by 23.10.2016 / 02:05
2
answers

How should you correctly terminate these variables without having a chance of memory leak?

What is the correct way to use free() in this case, where ls_options will contain several ls_buffer_send ? char **ls_options = (char**) malloc (200*sizeof(char)); char *ls_buffer_send = (char*) malloc (350*sizeof(char));  ...
asked by 27.07.2016 / 20:10
1
answer

Why use pointers as function parameters?

I already have some knowledge about pointer, but I wanted to understand why in most cases people use pointers as parameters in functions. I'm currently studying algorithms through the GeeksforGeeks portal, which I find very cool because it...
asked by 18.05.2017 / 13:46
1
answer

Use of typedef for pointer

If I have already set a pointer to my structure because I can not allocate it. #include <stdio.h> #include <stdlib.h> struct ponto { int a, b; }; typedef struct ponto *Ponteiro; // define um ponteiro para estrutura ponto typed...
asked by 10.09.2018 / 23:06
2
answers

Why do some functions that work with C strings start with *?

In one of our classes we were taught that when a function receives as a parameter a vector, it is actually receiving the memory position in which it is allocated, so it is not necessary to return any value since what will be executed within the...
asked by 28.04.2017 / 16:45
2
answers

Resize in dynamic pointer transforms dimension into garbage

I was responding to a std :: stack implementation problem. It was easy, but I could not use my first idea: std :: vector (it replaced forever the dynamic pointers). My code is: template <class T> class stack { T* data; unsigned s...
asked by 20.04.2014 / 21:41
1
answer

How to set a pointer as default parameter in C ++?

I'm "programming in C" but compiling using the .cpp extension and g ++ to have some facilities. My goal is to do a program that receives a starting salary and calculates the final salary according to a certain bonus. The bonus is given in...
asked by 21.08.2018 / 03:15
1
answer

Assign pointer to the array inside a function

I'm trying to write a function that assigns an integer or list of integers to a pointer, depending on a parameter. But the assignment does not work inside it, just outside: void retorna_algo(int size, int* destino){ if (size == 1){ *dest...
asked by 11.02.2018 / 07:10