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
1
vote
0 answers
Using pointer to pointer to make a dynamic matrix of integers
I'm trying to make a dynamic matrix that is based on an integer pointer to pointer, this variable is allocated dynamically, but I'm having a little trouble using it, I don't know if I am using it wrong or something, but the outcome is not as…

Troianos77
- 53
- 8
1
vote
5 answers
Return value 3221225477 occurs when I use pointer to struct pointer in code
What is wrong in my code below?
There are no errors or warnings when I compile it by Dev C++ compiler. But after I run my program there is execution error and following return value text:
Process exited after 5.1 seconds with return value…

Mika
- 11
- 1
- 3
1
vote
2 answers
Is this a pointer to a pointer of the start of an array?
I've just been helping someone out with some code. He had this:
char dataArray[10];
Then wanted to get a pointer to the start of the array. Rather than use:
&dataArray[0]
or just
dataArray
He used
&dataArray
Did he end up with a pointer to a…

DiBosco
- 838
- 8
- 21
1
vote
1 answer
Call native method from Swift that has uint8_t ** as output parameter
I have a C method with the interface
size_t foo(uint8_t ** output)
This gets imported to Swift as
func foo(_ output: UnsafeMutablePointer>) -> Int
How can I call this method from Swift?

Etan
- 17,014
- 17
- 89
- 148
1
vote
3 answers
Pass stream by reference
I am suppose to pass stream, which is a pointer, by reference. So I am passing this as a pointer to a pointer. Can someone please verify my code?
int main(int argc, char** argv)
{
FILE *stream;
printf("LINES: %d\n",scan(stream));
}
int…

user3337714
- 663
- 1
- 7
- 25
1
vote
0 answers
Python ctypes - Passing a pointer to a pointer
I have a DLL with a function of the following form:
void Foo ( int * i, char ** s )
{
if ( *i > (int)(strlen(date_string) + strlen(time_string) + 2) )
sprintf ( *s, "%s %s", time_string, date_string );
}
where
char date_string[] = {…

Monty123
- 103
- 1
- 7
1
vote
2 answers
Difference between the address of the variable that points to an array and the value of that variable itself
I have an array
int ar[5] = {1,2,3,4,5};
printf("%d",(ar==&ar));
The print statement returns true. But what if I do ar+1 and &ar+1. Where does that point to?
Also if I have
char *c[] = {"GeksQuiz", "MCQ", "TEST", "QUIZ"};
char **cp[] = {c+3, c+2,…

Dubby
- 1,154
- 3
- 16
- 31
1
vote
1 answer
pointer to a pointer, which is pointing to a memory block, which pointer should be freed?
At the end of the code below, which pointer would I need to plug into free(), array or temp_array? Does it matter which one or would either free the memory block?
int *array = 0;
int *temp_array = 0;
int count = 0;
array = malloc(sizeof(int));
//…

Aelyn
- 37
- 1
- 7
1
vote
5 answers
I thought double pointers were required when wanting to change values
When researching double pointers, the general consensus appears to be when wanting to change the value of any variable and retain the new value when returning from a function then its pointer value needs to be passed in.
When already working with a…

Unhandled Exception
- 1,427
- 14
- 30
1
vote
2 answers
Declaration and initialize pointer-to-pointer char-array
Concerning a pointer to pointer I wonder if its ok with the following:
char** _charPp = new char*[10];
for (int i = 0; i < 10; i++)
´ _charPp[i] = new char[100];
That is - if I want a pointer to pointer that points to 10…

user3155478
- 975
- 1
- 10
- 16
1
vote
1 answer
int ** array changing value
So I have an int **. It contains pixel values. What I'm trying to do is change the value of a set number of pixel values; say the value is 90, I want to change it to the max level that it has to create a black edge of x amount of pixels. I've been…

kevorski
- 816
- 1
- 11
- 29
1
vote
1 answer
double pointer that is passed gets corrupted during loops?
char **rhyme; // init my double pointer
rhyme=inputrhyme(); // calls below function to input the rhyme
char** inputrhyme(){
char **rhyme, *temp, *token, BUFF[300], s[2]=" ";
int length=0;
rhyme=malloc(length * sizeof(char*));
…

Charles Finley
- 49
- 8
1
vote
1 answer
Navigate through Array by Pointer to Pointer
I have tried to move through array by double pointer. Here is the Code.
void pptr (int **sptr2,int **ptr2)
{
**ptr2 = (**sptr2 + 7); //Works Fine
*sptr2++; *ptr2++; //Probable problem Statement
**ptr2 = (**sptr2 + 7); …

user3064278
- 5
- 2
0
votes
3 answers
Addresses in structures
The following is an abstract version of a problem I am currently having.
#include
int main()
{
typedef struct {
char * bar
} struct_t;
struct_t foo = {};
foo.bar = "test";
struct_t * p_foo = &foo;
…

DaRaRa
- 1
- 3
0
votes
1 answer
double pointer to the char array
I have been trying to figure out how double pointer works with char * and char [].
What I want to do is to assign a double pointer to the char * or char [] and then change the content.
#include
int main()
{
char * message2 = "bye…

Lucky Im
- 47
- 7