Most voted "pointer" questions
The tag can be used for the concept applied to any language. A pointer is a type of data that "points to" another value stored in memory using its address.
Learn more…481 questions
Sort by count of
-
1
votes1
answer113
viewsSyntax errors in C
I’m doing this exercise in C, but I’ve locked into this part of passing parameters with pointer. Basically the program below sums up the share of real numbers and integers. The problem is that the…
-
1
votes1
answer470
viewsDelete a struct record using free()
I’m creating a record using struct, where I must have a menu to include, show and attend (exclude) patients. The problem is in the exclusion function that because of my lack of knowledge I do not…
-
1
votes1
answer127
viewsHow to store a chained list
Hello, I have some questions that I will illustrate below: Having two double chained lists A and B with the structure struct lista { Ponto* dado; /* dado = número */ struct lista *prox; /* ponteiro…
-
1
votes1
answer120
views -
1
votes3
answers497
viewsChar pointer in printf() does not work
I decided to make this code simple, where I have an empty vector and a function that fills it only with a letter that the user type, but I’m not able to print. If I wear that printf() commented, it…
-
1
votes1
answer339
viewsCheck if the number typed is already present on the struc
Good afternoon, I’m facing the following problem. I need to make an algorithm for registering bank accounts of 15 people with the following information: account number, name and balance. However it…
-
1
votes0
answers99
viewshow does a function "const void *foo( param, param) work"?
bool cmp(const void * a, const void * b) { return static_cast < /*type?*/ * > a < static_cast < /*type?*/ * > b; } const void * min(const void * first, const void * last, size_t size,…
-
1
votes1
answer471
viewsArray of pointers with struct
I’m trying to assign 3 names to a string vector within a struct, and using pointers to reference the dynamically allocated struct, and then print and then reverse it into a repeat structure, but…
-
1
votes0
answers75
viewsReferencing a specific element of a bidemensional matrix via pointer notation
The C allows treating each row of a matrix of two dimensions considering them as a matrix of one dimension. As we know, one way to reference two-dimensional matrices in the form of C pointers is,…
-
1
votes0
answers47
viewsProblem with Pilha
Good night, you guys! I’m trying to do a 2011 OBI exercise. Here’s the link to it: Exercise OBI 2011- Expressions and found some problems to accomplish it. In short, the exercise provides you with a…
-
1
votes1
answer38
viewsProblem with search and insertion function
I tried to write the code below out of curiosity. For some reason, even after doing the functions of insertion and verification (checks if a value exists within the array), the return is that there…
-
1
votes3
answers573
viewsincompatible types when assigning to type ‘tipoNo’ {aka ‘struct tipoNo’} from type ‘tipoNo *’ {aka ‘struct tipoNo *’} arv = inserir(&arv, 5);
I’m trying to implement the method of inserting a binary search tree. This is the struct I’m using typedef struct tipoNo { int chave; struct tipoNo *esq, *dir; //apontadores da esquerda e direita }…
-
1
votes2
answers141
viewsPointer struct
With a view to the following structures: typedef struct celEstado *apontadorEstado; typedef struct{ char nome[30]; int populacao; int beneficiarios; int qtdCidades; float idh; apontadorEstado…
-
1
votes1
answer67
viewsList of states where each node will be linked to a binary city search tree
Good afternoon, I wanted to know how to make a chained list of states where each state node is linked to a binary city search tree from information extracted from a file. My doubt arose after…
-
1
votes1
answer210
viewsfunction to insert a no in a linked list in C
How to complete the missing code in lines with 1. 2. 3. 4.? The goal is to add a new node with a given name and age at the end of the list. NOTE: I know there are less confusing and more practical…
-
1
votes1
answer251
viewsBucket Sort - C
I’m having problems implementing the Bucket Sort sorting method, I need to test it 30 times with different amounts of data, but when I try with 100000 it presents me this error: "Process returned…
-
1
votes1
answer70
viewsDoes the char vector have a minimum size?
I’m doing a huge job and he’s given a bug very strange when allocating vectors of char with specific sizes. After a lot of headache I decided to do a small test. #include <iostream> using…
-
1
votes0
answers20
viewsDoubt regarding C pointers
I am writing a program that has 3 files: algorithms. h, algorithms. c and main. c. This program has several integer vector ordering algorithms. With the intention of making the program more…
-
1
votes1
answer67
viewsWhat’s wrong with this array of pointers in C? (incompatibility?)
Hello, recently I was doing a relatively simple test to try to unify some concepts I have been studying, and which you will see below. It is an array of pointers that I used as a parameter of a…
-
1
votes1
answer72
viewsHow does access to struct by pointer pointer and by a copy of the pointer work?
In push1() I passed by parameter the memory address, on push2() I passed a copy of the pointer, but I didn’t understand the difference how each one accesses the struct? struct Node { int data;…
-
1
votes1
answer54
viewsHands with variable float and char
I am unable to assign an address to a pointer variable when it comes to float or char variables, the visual studio brings me the error "C++ a value of type cannot be Assigned to an Entity of type".…
-
1
votes2
answers1848
viewsRecognize enter key in C
I’m trying to make a code that only prints the third to a typed string, but my program is endless, how to recognize the given enter for the program to end? #include <stdio.h> #include…
-
1
votes2
answers342
viewsError exited, Segmentation fault in C
I’m trying to make a function that returns me a date according to an integer and always appears the error: exited, Segmentation fault The code I created is basically this: #ifndef DATA_H #define…
-
1
votes3
answers170
viewsHow to query a struct array in C after you have already written on it?
Hello, I want a help I am making a program that has a menu the registered user and then consult the registration, the problem and I am not being able to consult the "database" vector of structs. The…
-
1
votes3
answers68
viewsPassage by reference in C
My IDE is giving error in line: float CalculaHora(horas,minutos,segundos,&conversao); It indicates that you need a parenthesis before the operator &: #include <stdio.h> int main() {…
-
1
votes0
answers40
viewsC++: Add an integer variable in an ordered way in a list
I need to add integers in an orderly way, within a list implementation that I developed. //Implementação dos nós para serem usados na lista NodeList::NodeList(int dataa){ this->next = NULL;…
-
1
votes1
answer38
viewsHow to pass a list of pointers that references functions as a parameter
I have a list of pointers that refer to functions in my code and I need to pass this list as a parameter to a function that prints the cases: double f00(double x){ ... return x; } double f01(double…
-
0
votes1
answer640
viewsPass pointer as C++ function parameter
Good morning guys, I have the following problem: I have a class that represents a List, and from it I created three objects (I don’t know which one to give) list1(5), Lista2(5), list3(10).…
-
0
votes1
answer658
viewsIs it possible to pass string from string class as pointer to function?
it is possible to pass string from string class as pointer to function? example: void separaStr(string *modulo, satring *nmodulo, *digito){}
-
0
votes1
answer104
views -
0
votes0
answers55
viewsRetrieve data from another process
I wonder if there is some way in C++ to take some data (value) of a process, but without using a pointer to the memory, because when I try to use the Cheat engine, until I find the dynamic address,…
-
0
votes1
answer234
viewsWhy does this seemingly simple implementation of "strupr" not work?
Error implementation in GCC: char* strupr( char *str ) { while(*str) { *str++ = toupper(*str); } } Note that str is used twice in the assignment.…
-
0
votes3
answers103
viewsC pointers, error calling the relocation function
I have the C code written below, whenever I want to invoke the function of an error that says: --/home/Amuel-o-cara/Documents/Data Structures and Algorithm/Class 13.04.16 Alocarmemoria/main.…
-
0
votes1
answer70
viewsWhy can’t I print content in Chained List
Good evening, I have a problem with a college job. I need to create a linked list that receives student records. I created a function to register, however, I can not print, externally, the contents…
-
0
votes2
answers1846
viewsError invalid Conversion from 'int' to 'int*' using -fpermissive
I’m following a series of video-lessons in C (https://youtu.be/zZlIy3hp0c0?t=10m29s), but I found a problem. First I ran this code: #include <stdio.h> int main(void) { int x = 10; int…
-
0
votes1
answer380
viewsrequest for Member 'attributeOuDecisao' in Something not a Structure or Union
Tree initialization error, the problem with the category variables and atributoOuDecisao. typedef struct node { int categoria; int atributoOuDecisao; struct node *prox; struct node *lista; } No; No…
-
0
votes1
answer139
viewsDoubts about pointer pointers and function returns
Hello, folks. I’d like to know why the function below would need a pointer to pointer, in case a **root, for the line /1/ could modify the *root, while the line /2/ can modify it without having to…
-
0
votes1
answer155
viewsError writing binary file using fwrite
Why this code snippet DataRootDir data = rootdir[i]; fwrite (data, sizeof(DataRootDir), 1, arq); always returns the error error: cannot convert 'DataRootDir' to 'const void*' for argument '1' to…
-
0
votes1
answer65
viewsProblem with matrix editing outside of main()
So, guys, I’m in over my head with the code below. I started studying C pointers a few days ago and I believe it’s the solution to my problem, but I don’t know how to handle the code. The problem is…
-
0
votes1
answer112
viewsPass by reference of a vector structure in C!
I have the following code: #include <stdio.h> #include <stdlib.h> #include <string.h> #define TAM 3 typedef struct{ char nome[50]; char musica[50]; int integrantes; int ranking;…
-
0
votes0
answers24
views& Operator in C++
I am studying C++ and I have doubts about this operator &, when should I use? void funct(int *var) { (*var)++; } void funct(int& var) { var++; } These two function increments the varial, but…
-
0
votes1
answer127
viewsNumber of elements allocated from a pointer
I need to know how many elements are allocated in my pointer pointer. For example with vector, sizeof(v)/sizeof(v[0]) this way I get the number of elements that this vector has. I would like to do…
-
0
votes1
answer57
viewsCan someone help me with the Pointers in function, in this code?
Guys, after implementing the function deleting my code no longer works, could someone help me? without deleting function is working, what is wrong with it? //biblioteca #include<stdlib.h>…
-
0
votes1
answer74
viewsIs this valid (x = (*mat)+;)?
(x = (*mat)++;) If it is valid, explain to me why and how it will work.
-
0
votes1
answer70
viewsWarning on battery hands
I’m trying to make a simple stack implementation, however the message appears: Warning: initialization from incompatible Pointer type -Wincompatible-Pointer-types This Warning appears on both line…
-
0
votes1
answer1360
viewsCall any function of another class of the same type
I need to pass as a parameter to a member function another member function (but of another class). I can do this for same class functions, but from another #include <iostream> using namespace…
-
0
votes1
answer113
viewsHow to turn into a tiny value of a struct?
The next function should turn variables into lowercase and then compare them. I’ve tried converting before, but also bugged. Arithmetic use of pointers together with variables of a struct. Pointer…
-
0
votes1
answer115
viewsWhat is this operator **?
What is this operator **, and what is it for? Every time I come across a piece of code in C++ with this operator. And if it is related to *, what’s the difference?
-
0
votes0
answers90
viewsDoubt with C pointers
Hello, I am looking for the problem hrs in this excerpt (implementation of an avl tree) but I can not find, I pass a Dictionary D to this function and its value is modified within the context, but…
-
0
votes1
answer286
viewshow to resolve "SIGSEGV" error when using`strcpy`
Hello, I am facing an error "SIGSEGV": strcpy(buffer_ReceiveAutomation, ls_buffer_PPouAUT); << ERROR and buffer is incomplete from recv, but if I change the sizeof(ls_buffer_PPouAUT) by the…