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

Allocating a list of pointers in CUDA

So, I'm trying to allocate a list of pointers, each pointing to a struct on my device, but I keep getting a segfault. This works fine on with a normal malloc, but with cudaMalloc, things get fishy. struct body //struct holding information for one…
Chris Phillips
  • 1,997
  • 2
  • 19
  • 34
0
votes
1 answer

Compile time warnings double pointer in C language

Here, I have created a structure called directory. Which has double pointer to children and single pointer to parent. typedef struct { struct directory** children; struct directory* parent ; }directory; Here, I have…
user2737926
  • 97
  • 1
  • 1
  • 9
0
votes
1 answer

how to create const int** from int**

Is there way to create an const int** from an int**? I'm currently using: const int **pixel2=*pixel; const char **header2=*header; I keep getting the error: cscd240HW34.c:52:21: warning: initialization from incompatible pointer type [enabled by…
kevorski
  • 816
  • 1
  • 11
  • 29
0
votes
3 answers

free up memory on a double pointer

//char char **p; declared in .h file size_t bs = 5; size_t Size = sizeof(obj); p = (char**)malloc(bs); for (size_t i = 0; i < bs;i++){p[i] = (char*)malloc(Size);} for (size_t j = 0; j < bs-1; j ++){p[j] = &(p[j + 1][0]); } for (size_t i = 0; i <…
0
votes
1 answer

Could anyone please explain me this piece of code?

"header" is an object of a struct and you can consider header.img to have a value of 496. And header struct has 3 integer elements so is the value 12 bytes. (Considering 4 bytes a int) double** MatrixBuffers = new double* [header.img]; …
quantumshiv
  • 97
  • 10
0
votes
2 answers

Getting Error : lvalue required while trying to implement a Jagged Array in C

I am trying to implement the concept of Jagged Array while learning the C language. My code goes below :- #include #include int main() { int r,**a,n,i,j,*ptr; do { printf("Enter no. of Rows : "); …
0
votes
3 answers

doublepointed list C

I wanted to make a list using double pointer and using void as return. #include #include typedef struct list{ int value; struct list *next; }*list; void addnode(struct list **List, int number) { if(*List == NULL) { …
user2851726
  • 53
  • 1
  • 1
  • 4
0
votes
2 answers

Double pointer upcast (again), shared_ptr and generic setChild function in a polymorphic tree class

I have an abstract Node class, derived in many subclasses, such as Color, Texture, Shape, Light, etc... containing my application user data. The data consists in a large tree of these nodes. Each Node subclass has a fixed number of children, which…
galinette
  • 8,896
  • 2
  • 36
  • 87
0
votes
3 answers

Double pointer in c, assignment warning for my code

I don't know why I am getting warnings for the following code. #include #include int main() { int **p; int i,j; for(i=0;i<5;i++) { if(i==0) p=(int*)malloc(1*sizeof(int)); else …
0
votes
2 answers

Want to pass a single char pointer from a double pointer

I have to write a function which takes in 2 double pointers (both to char type). The first double pointer has a string of query values and the 2nd one has stopwords. The idea is to eliminate the stopwords from the query string and return all the…
0
votes
2 answers

Setting a double pointer array

I know there are a lot of double pointer questions, but I couldn't find one that pertained to starting an array. In the code below, I can set pointers in main by ptrs[0] = &array[0];, but the code halts when enqueue() calls *queue[i] = p;. Why is…
Eric Fossum
  • 2,395
  • 4
  • 26
  • 50
0
votes
0 answers

Initialize double pointer of structs

I am trying to have an array of pointers to generic linked lists within a generic hash table be allocated dynamically with the size being dependent on user input. Please let me show you the code. This is the driver, the user would input the size…
Reuben Tanner
  • 5,229
  • 3
  • 31
  • 46
0
votes
1 answer

Another option to double pointer

How could I send a pointer to a function with reference? I mean, I would like to change where the pointer is poiting in that function. I have seen for this the double pointer, like for example: Abc* p; function(&p); function(Abc** p){ (*p) =…
Frion3L
  • 1,502
  • 4
  • 24
  • 34
0
votes
2 answers

argv function and string as address in C language

Question. How come the strings such as "C Programming" is compiled as address values as following? #include void ShowAllString(int argc, char * argv[]) { int i; for(i=0; i
user2172254
0
votes
1 answer

Create a double pointer (ptr to ptr) to std::pair with boost

I have the following code which I want to rewrite to make use of smart pointers: I'm struggling to find any decent examples of how to declare, allocate memory and access the double pointer. Can anyone provide an example? I have read that shared_ptr…
user2089851
  • 151
  • 1
  • 3
  • 12