Skip to main content
Filter by
Sorted by
Tagged with
1 vote
3 answers
1k views

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 *...
user3337714's user avatar
1 vote
0 answers
782 views

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, ...
Monty123's user avatar
  • 103
3 votes
2 answers
276 views

To be clear, I want the behavior of a pointer-to-a-pointer, and the purpose of this question is to generate clean, readable code. I have some code that contains conditions checking the result of ...
Collin Dauphinee's user avatar
-4 votes
2 answers
81 views

C++ smart pointer: if in a class, I define a pointer pointing to a smart pointer, does this eliminate the advantages of smart pointer? (Note, I didn't say I want to apply this kind of usage) Like: ...
user1914692's user avatar
  • 3,073
3 votes
7 answers
107 views

I have tried the output of the following code. But, i don't yet understand what might the value of q represent. I understand that the *q points to p implying that, printing *q would print the address ...
Arjun M's user avatar
  • 33
0 votes
1 answer
157 views

I am trying to find the maximum sum leaf to root path in a Binary Tree as in below http://www.geeksforgeeks.org/find-the-maximum-sum-path-in-a-binary-tree/ 1) I am unable to find why the path doesn't ...
sparco's user avatar
  • 85
1 vote
2 answers
164 views

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[] = {"...
Dubby's user avatar
  • 1,144
0 votes
5 answers
330 views

Code is like this: void insertNode(TreeNode **root, COMPARE compare, void* data) { TreeNode *node = (TreeNode *)malloc(sizeof(TreeNode)); node->data = data; node->left = NULL; ...
Dulguun Otgon's user avatar
0 votes
1 answer
802 views

I want to pass a pointer of pointer of object to a function but get the error invalid conversion from 'CustomInterface**' to LocalLogger**' I try something like this: class LocalLogger {} class ...
Psy-Kai's user avatar
  • 187
0 votes
1 answer
72 views

I've got the following code: #include <iostream> #include <vector> #include <cstdlib> #include <ctime> using namespace std; struct Node { int value; Node *left, *right;...
user1113314's user avatar
0 votes
2 answers
46 views

While writing the add function for Linked List I came up with the following piece of code int addNode(node ** head) { 1. node * ptr = *head; if(ptr==NULL) { ...
Dubby's user avatar
  • 1,144
1 vote
2 answers
5k views

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 ...
user3155478's user avatar
  • 1,065
-1 votes
1 answer
223 views

I am a beginning level coder, and am coding dfs bfs, bt its reapetedly showing error,I have assigned an array of nodes for wich i have used pointer to pointer, however when i assign values to elements ...
user3505754's user avatar
0 votes
0 answers
115 views

I got a void **stack which contains the addresses of the struct pointers my problem is that when I print the whole stack different addresses are shown than the actual addresses I'm actually trying to ...
MattSt's user avatar
  • 1,203
0 votes
2 answers
12k views

I got 2 structs,a pointer to each struct and a void **stack which points to the pointers of the structs. my problem is at the line (*ptr2+*a)=(struct student *)malloc(sizeof(struct student)); *a is ...
MattSt's user avatar
  • 1,203
0 votes
2 answers
80 views

I want to return in my function the n - size of the matrix - and the matrix itself at *p. The file is something like, for example, 3 10 20 30 this is how I call it: main( ) { ...
kazama's user avatar
  • 211
2 votes
1 answer
4k views

I have a small program as shown below.This program is an attempt to better understand pointers in 'C' how variables are arranged in memory. #include <stdio.h> const char *c = "hello"; const ...
liv2hak's user avatar
  • 15k
2 votes
3 answers
13k views

I am trying my hand at C by implementing Conway's game of Life. I am trying to dynamically build two grids (int matrices), one for the current and one for the next generation, so after I determine ...
mydoghasworms's user avatar
1 vote
1 answer
322 views

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; ...
Charles Finley's user avatar
2 votes
1 answer
282 views

Okay, so consider this code: char** pool = new char*[2]; pool[0] = new char[sizeof(char)*5]; As far as I know, this creates a pointer to an array of 2 char pointers. The second line then sets the ...
scorkla's user avatar
  • 300
0 votes
0 answers
103 views

I have a function that is supposed to return a double pointer, it is supposed to return the address of the pointer to a piece of data which in this example is a character array The original data is ...
Sizdian's user avatar
  • 79
0 votes
1 answer
97 views

I have an an integer array of values and I would like to make a double pointer to point to this array. I assume that this 1D integer array actually represents a 2D array. That is for instance that if ...
Nick's user avatar
  • 190
6 votes
7 answers
3k views

int num = 45,*ptr1,*ptr2; ptr1=&num; ptr2=&ptr1; printf("%d\n",*ptr1); I've been thinking about this question for a while, but couldn't find a way to understand it,why &ptr1 can not be ...
user2556058's user avatar
6 votes
2 answers
4k views

When you create the multi-dimensional array char a[10][10], according to my book it says you must use a parameter similar to char a[][10] to pass the array to a function. Why must you specify the ...
rubixibuc's user avatar
  • 7,484
2 votes
6 answers
2k views

The follow program declares a pointer then again a new pointer to hold address of previous pointer variable.. How much can I use nested pointer variable to hold memory address is there any limit? #...
Vishwanath Dalvi's user avatar

1 2 3 4
5