All Questions
Tagged with pointer-to-pointer struct
26 questions
0
votes
3
answers
98
views
Addresses in structures
The following is an abstract version of a problem I am currently having.
#include <stdio.h>
int main()
{
typedef struct {
char * bar
} struct_t;
struct_t foo = {};
...
0
votes
1
answer
56
views
Getting Null iterate through to next element of array using pointers
#import<stdio.h>
#import<stdlib.h>
typedef struct Video {
char *name;
int unique_views;
} Video;
typedef struct Viewer {
char *username;
Video *watched_videos;
int ...
0
votes
1
answer
71
views
struct using a pointer, ... in something not a struct or union
I defined a structure called coordonnees declared as a pointer, I want to append values to the pointer a_visiter but it's not working. How can I fix that?
Here is the struct code:
typedef struct ...
0
votes
1
answer
68
views
How to update field of a pointer to a struct in C?
Im trying to update a field of a struct that's a pointer like so:
typedef struct Data *STRUCT_POINTER;
typedef struct Data
{
int element;
STRUCT_POINTER next;
} STRUCT_NODE;
void manipulate(...
-2
votes
1
answer
119
views
In C can expressions be pointers?
struct node
{
int a;
};
int main()
{
struct node y = {24};
struct node *x = &y;
return 0;
}
I have recently been having trouble to see how the expression &x is a pointer ...
2
votes
3
answers
316
views
How does &pointer have type pointer to pointer?
struct node
{
int a;
};
int main()
{
struct node y = {23};
struct node *x = &y;
return 0;
}
Here is some code i came across, i messed around with the code and found out ...
0
votes
4
answers
140
views
How is &head of type pointer to pointer?
assuming we have a pointer called
struct node *head
When referring to this as &head the type becomes pointer to pointer (struct node**) why is this?
-1
votes
2
answers
86
views
How is this variable of type pointer to pointer
struct node
{
int data;
struct node *link;
};
struct node *addnode(struct node **head);
int main()
{
struct node *head = NULL;
addnode(&head);
return 0;
}
struct node *...
0
votes
1
answer
104
views
C - Writing a struct into a 2D array causes Segmentation Fault
I'm trying to write a program that reads a text file into a 2D array of structs, but trying to put a struct into that array causes the program to crash.
Here's the program
ppm.c
#include "ppm.h&...
-1
votes
1
answer
38
views
Why is a pointer to a structure not overridable in a function? [duplicate]
lets look at this code:
typedef struct nodes{
int val;
struct nodes next;
} node;
insertHead(node *list, int val) {
node *temp = malloc(sizeof(node));
temp->val;
temp->next =...
1
vote
1
answer
577
views
qsort on dynamic array of dynamic structs [duplicate]
I have the following struct
struct FOO {
int x;
double y;
}
and the array
FOO **manyfoos;
manyfoos = malloc( 10 * sizeof(FOO *) );
After this manyfoos is filled with dynamically allocated ...
2
votes
0
answers
51
views
CUDA: copy of a struct containing a double pointer [duplicate]
I have a struct which contains a double-pointer like this:
struct image
{
int width, height;
uchar** imageData;
}
and then
Image* h_imageList = (Image*)malloc(20 * sizeof(Image));
//fill ...
0
votes
1
answer
199
views
Initialise Pointer to Pointer for struct
i have a console based application in which i am using pointer to a pointer. It is minesweeper game in which i need to create board using pointer to a pointer. I have to pass my this pointer to ...
-2
votes
2
answers
1k
views
Assigning values to properties of a 'struct ** record'
I'm having troubles understanding the C double-pointer concept. Essentially, I'm trying to write code which will check if record_1 hasn't been set yet. If not, set it. If it has been set, we'll add a ...
1
vote
1
answer
103
views
Accessing pointer to pointer of struct using -> operator
I have this code:
#include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node *next;
};
void pointerOfPointer(struct node **reference)
{
struct node *temporary =...