Pointers are variables themselves, so a pointer that points to another pointer is a pointer to pointer. A pointer to pointer is sometimes mistakenly referred to as "double pointer".
Questions tagged [pointer-to-pointer]
234 questions
0
votes
3 answers
Use a variable from pointer that is pointed by a struct which (that structs') pointer is sent to a function that needs to use it
Welp, thats a kind of a pointerception.
So.
Im using gtk+
In gtk I define buttons like this:
GtkWidget *button1, *button2;
so I need a function do do something with this. So I make a struct that will hold a pointer to it
Here it is:
typedef struct…

Karol Szustakowski
- 332
- 1
- 15
0
votes
0 answers
Insertion in doubly linked list C++
I've been working a lot with double pointers to solidify my knowledge of what they are and how I can use them, and I recently ran into a very weird problem. I'm trying to write code to insert a node into a doubly linked list using a double pointer…

A Zhang
- 23
- 4
0
votes
2 answers
Pointer to pointer Array
I am trying to make an 'int** arr[5]' the each cell in it contains an 'int* array', each 'int* array' has a different size. Whenever i am trying to print one of the cell it prints only the first number in it, why is it happening? how can i print the…

Yazen Vid
- 21
- 3
0
votes
0 answers
C++ printing out int** arrays?
This is a beginner question, but I'm just trying to get comfortable with pointers to pointers here.
If I create an array of arrays like this:
int n; // n lines
cin>>n; // read in first line, number of lines in array of arrays
int…

Austin
- 6,921
- 12
- 73
- 138
0
votes
1 answer
CUDA: Memory allocation for pointer to pointer using cudaMallocHost(...);
I changed my method to allocate host memory from method 1 to method 2 as shown in my code below. The code can compile and run without any error.
I just wonder is it a proper way or any side effect to allocate memory for pointer to pointer using…

Cqiao13
- 29
- 1
0
votes
2 answers
Iterative loop through linked list
This simple program creates a linked list that has an acronym and its complete phrase. There are two functions:
The first one creates a node and if the list is empty it puts the node in the first place, otherwise it is put at the end of the…

Mattia Righetti
- 1,265
- 1
- 18
- 31
0
votes
1 answer
nested struct with nested pointers
I am using a data structure to implement a spellchecking. I had two struct, node and table, which are defined in the following:
#include
typedef struct node *tree_ptr;
typedef struct table * Table;
struct node
{
char* element;
…

NUO
- 247
- 2
- 3
- 14
0
votes
3 answers
How to free a double pointer that need to be returned from the function?
For example this is the codes for a function file, named fnx.c, where func() will be called from the main function. How should I free the TempArray here while return the double pointer to the main function at the same time?
int * * TempArray;…

randomGirl
- 21
- 7
0
votes
2 answers
Pointer-to-Pointer and linked list, passing parameters per value
Background is that I am experimenting with pointer-to-pointer in C by implementing a linked list. My question is regarding the difference in the two pieces of code and why the first one is giving expected output, but not the other one. Why does the…

TutenStain
- 237
- 2
- 6
- 18
0
votes
1 answer
Passing pointer-to-char in function: syntax error
My question is related to my previous post:
explicit specialization: syntax error?
I am trying to pass arrays of pointer-to-chars as an argument to a function (which I will later incorporate to a specialized function from previous post), but I…

mi5tch
- 1
- 2
0
votes
1 answer
Is there mechanism for constant pointer to pointer in C?
I wonder does C/C++ allow one to use "const int **" in function call?
Suppose I have a matrix, which can be accessed by pointer to pointer. When I want to use this matrix, and forbid modification of any value in this matrix, can I do "func(const int…

sciencemonk
- 69
- 5
0
votes
2 answers
c pointer to pointer how to iterate through it
struct hashLink
{
KeyType key; /*the key is what you use to look up a hashLink*/
ValueType value; /*the value stored with the hashLink, an int in our case*/
struct hashLink *next; /*notice how these are like linked list nodes*/
};
struct…

Gina Brown
- 11
- 3
0
votes
1 answer
operator= overloading with double pointers for fraction math
Originally, my lab was passing three argument: addFractionJesseR(*lFrac, *rFrac, **resFrac); but I just found out I can't pass three arguments. I had to change it to **resFrac = addFractionJesseR(*lFrac, *rFrac); and now I'm having problems…

JRags
- 13
- 5
0
votes
3 answers
End of integer/structure array?
Consider the following functions
void alloco(int **ppa)
{
int i;
printf("inside alloco %d\n",ppa); /*this function allocates and fills 20 * sizeof(int) bytes */
*ppa = (int *)malloc(20 * sizeof(int));
/*fill all 20 * sizeof(int)…

pa1
- 778
- 3
- 11
- 26
0
votes
3 answers
How possible that an memory address also have another memory address ?
I have stored the address of a integer variable in a pointer and then store the address of that previous into another pointer.I am not able to understand how it actually works.
#include
using namespace std;
#include
int main…

Naresh
- 155
- 1
- 9