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
-1
votes
1 answer

How to get the size of a double pointer array?

How can I get the size of a dynamically allocated array of double pointers? (pointer to pointer datatype) int tokencnt=1; tokenv=(char**)malloc(sizeof(char*)); while(tokencnt<11){ …
-1
votes
2 answers

Assigning a Pointer through a Double Pointers

int m = 5, n = 6; int *p,*q,**r; p = &n, q = &n; r = &p; cout<
Madare
  • 7
  • 1
-1
votes
2 answers

Passing Array to function using double pointer

I was trying to get array updated through a function as in below code and this works fine. char bookCategory[][MAX_CATEGORY_NAME_LENGTH] = {"Computer", "Electronics", "Electrical", "Civil", "Mechnnical", "Architecture"}; uint8_t…
Rajesh
  • 1,085
  • 1
  • 12
  • 25
-1
votes
2 answers

c++ how do you convert 2D Array to 2D array using Double pointers -- m_array : Array to m_array T**

I'm trying to take my 2D array program and just change a class private setting from (UML CODE) -m_array: Array to -m_array : T**. This is a requirement for the Data Structures Class... for one of the assignments Array m_array; //…
-1
votes
1 answer

Pointer-to-Pointer Arithmetic: Assigning Values

My program is generating 4X4 matrices and a vector of constant terms that looks like this: av + bx + cy + dz = e a2_v + b2_x + c2_y + d2_z = e_2 a3_v + b3_x + c3_y + d3_z = e_3 a4_v + b4_x + c4_y + d4_z = e_4 In my generateContentForSystems method,…
maddie
  • 1,854
  • 4
  • 30
  • 66
-1
votes
2 answers

How do the double pointers (struct tree_st **root) actually work?

We have to create a binary tree with car models and modify it in different ways. The main problem for me is the use of a double pointer (struct tree_st **root). Why can't I just use a standard, single pointer? Here's the code if you need more…
Muge
  • 21
  • 8
-1
votes
1 answer

The value of the pointer pointed to by the double pointer is lost (c code)

I am working on a c code that does some manipulation on SIP messages to be more specific it extracts values from the SDP body of the message. I am not a professional in c, but using the knowledge I gained from a course in my university I wrote my…
Ta.Da
  • 68
  • 1
  • 10
-1
votes
1 answer

passing 2D arrays into a function

I want to pass two 2D arrays into a function in order to copy the whole array. I am using double pointers to do this but it is showing error. void copy_arr(float **new_table,float **table,int m,int n) { //code return; } It is showing error…
kumar649
  • 1
  • 1
-1
votes
3 answers

modifying double pointer to an integer array

I have a pointer to an int *array, I allocated it and then pass it to a function in order to fill in the elements of the array. void function(int **arr); int main() { int *array; array=calloc(4, sizeof(int)); function(&array); …
ReshaD
  • 936
  • 2
  • 18
  • 30
-1
votes
1 answer

Pointing an array of string inside a void

I have a little problem passing a pointer inside a void. This void show only the firts position of the array of struct. When the loop go to second position i get "segmentation fault".I tried to show the array inside the main with the same loop and…
Jilz
  • 31
  • 5
-1
votes
1 answer

How do I scan into a pointer that points to a structure pointer in c?

I keep getting a seg fault and I want to use double pointers. I have a pointer to a pointer to a struct and I don't know how I can scan a double pointer to the pointer that points to the struct. int main(int argc, char* argv[]) { if(argc !=…
-1
votes
3 answers

Why in C++ do I need to pass a pointer by reference to change the pointed content?

I am writing a function to load text from shader code file. I have stumbled upon something strange regarding pointers and I cannot figure out why. I have a function named Load. In this function I copy text, taken from a file stream, in the output…
codingadventures
  • 2,924
  • 2
  • 19
  • 36
-1
votes
1 answer

Casting a uint** to a uint

I have the below code unsigned int headerbytes = 0U; headerbytes = (unsigned int*)strtoull(packet_space->header, NULL, 0); packetHeader header = deconstructPacketHeader((&headerbytes)); packet_space is a char[], basically its a 4byte char…
will
  • 1,397
  • 5
  • 23
  • 44
-2
votes
1 answer

Right way to delete pointer to pointer in C++

I have this simple example which fails in "delete poinerToBufferPointer": char* buffer = new char[8]; memset(buffer, 1, 8); char** poinerToBufferPointer = &buffer; delete poinerToBufferPointer; delete[] buffer; But if I comment the "delete…
user63898
  • 29,839
  • 85
  • 272
  • 514
-2
votes
1 answer

How does the memory layout look like when a double pointer is assigned to a single pointer?

I am currently working on a legacy code (still proprietary, so we'll have to make do with an MRE instead; and by legacy I mean code written in 1991). This is what I've come across: #include void foo(void*& ptr2) { // whatever …
justanotherguy
  • 399
  • 5
  • 16