Questions tagged [double-pointer]

The term "double pointer" is sometimes confusingly used to refer a data type which can point to another pointer. This name is confusing because it may mean a pointer to a `double` floating-point object. Please use [pointer-to-pointer] instead.

The term "double pointer" is sometimes confusingly used to refer a data type which can point to another pointer. This name is confusing because it may mean a pointer to a double floating-point object. Please use instead.

337 questions
0
votes
2 answers

How to convert char *a[] into char **?

I'm trying to return a char** while working with an array of char* Is there any way I could do this effectively? char *pos; if ((pos=strchr(line, '\n')) != 0) *pos = '\0'; //parses command in input (max of (arg_num - 2) flags) int…
CodeSammich
  • 150
  • 1
  • 2
  • 10
0
votes
0 answers

C pass (double)pointer as reference / parameter with malloc

I want to pass a variable by parameter and then allocated a memory region using malloc to that parameter. Actually, I know how to do that, but I was wondering why this function does not work as I expected: void temp1(int *a) { int *b = (int*)…
Daniel Bonetti
  • 2,306
  • 2
  • 24
  • 33
0
votes
2 answers

My project crashes when trying to use doubly indirected pointers (char **)

#include #include #include #define N 8 void func (char* ch,char **c1_a,char **c2_a,int* c1_s,int* c2_s) { char* c2_a; int i; for(i=0; i= 'A' && ch[i] <= 'Z') …
Itay Zaguri
  • 43
  • 1
  • 7
0
votes
0 answers

Using pointer to point to array of pointer that points to struct

I am having some trouble starting my program. I'm new to this. I have done some research and found some resources, but I have trouble applying it to the code. It is mostly based on pointers and structures. I mainly need help with learning how to…
0
votes
1 answer

add value from file to double pointer

my .h file #ifndef ADJACENCYMATRIX_H_ #define ADJACENCYMATRIX_H_ #include #include #include #include #include using namespace std; class AdjacencyMatrix{ private: int vertexCount; int…
Piotr Badura
  • 1,574
  • 1
  • 13
  • 17
0
votes
1 answer

(C++) Constructor for HashTable

I'm trying to create a class for a HashTable implementation Since I'm doing a chained HashTable, my hashTable starts out as a an array of pointers of type "object". What I am having trouble with is my constructor since in my main file, I'm going to…
GusGus
  • 230
  • 6
  • 16
0
votes
2 answers

double pointer variable giving access violation error in c++ structure program

I am trying to access a member of structure 'Word' through another structure 'Dict' using double pointer ** but getting 'access violation' error in visual studio 2010. I checked link "accessing double pointer to structure" also on stackoverflow but…
0
votes
2 answers

Basic issue with C double pointers (matrices)

I am relatively new to programming in general, and I'm trying to write some code to work with square matrices. Unfortunately, I'm stuck very early in the development, as the code typedef struct Matrix_t{ float** content; size_t…
Luigi D.
  • 165
  • 1
  • 10
0
votes
1 answer

List with a head as double pointer

If i have a list of lists as typedef Struct b { int b; Struct b *next; }B; typedef Struct a { int a; Struct a *next; B *link; }A; and if i develop the data structure following this scheme.. I use a double pointer as head for B for keep track of…
Luca
  • 55
  • 7
0
votes
1 answer

How to call a member function of an object using that object's pointer?

I have a Node object that has a public member function. When I have a pointer (or double pointer) in this case pointing to the original object, how do I call the member function? Here is the member function in the Node class: class Node { public: …
Jacob Varner
  • 340
  • 1
  • 4
  • 16
0
votes
2 answers

Allocating a pointer by passing it through two functions

What am I doing wrong here? Am I allocating memory to the original charPtr or something else? Why can I read the value of charPtr within func2but not in main (charPtr is NULL in main)? #include #include void func2(char…
Marko Galesic
  • 472
  • 5
  • 17
0
votes
2 answers

C Double pointer Char is printing NULL. Don't Know what's going wrong?

This is display function to display the strings read in. void print(char **s,int T) { while(*s) { printf("i: String : %s\n",*s++); } } int main() { int T =0,i=0; char ** s, *c; printf("Enter number of…
Sandeep
  • 13
  • 4
0
votes
1 answer

scoped_ptr for double pointers

Is there a halfway elegant way to upgrade to following code snipped by the use of boost's scoped_ptr or scoped_array? MyClass** dataPtr = NULL; dataPtr = new MyClass*[num]; memset(dataPtr, 0, sizeof(MyClass*)); allocateData(dataPtr); // allocates…
user1709708
  • 1,557
  • 2
  • 14
  • 27
0
votes
1 answer

C++ avoid checking uninitialized value held by double pointer

Solved Problem ultimately stemmed from the design of the data structure. To remove the root element there had to be a heap allocated (new) pointer to it, which wasn't possible in the original case where the data was held directly by the tree. Now…
LemonPi
  • 1,026
  • 9
  • 22
0
votes
1 answer

pthread, linked list with a double pointer

I have finally got so far to create an accurate consumer-producer type model for some test application I am making but the last bit is causing me some problems. I have 2 structs set-up for my application. One is used for a linked list which is used…
user2882307