Am I correct to say that if I want to change the content of a variable in a structure I have to give a pointer to the structure, using a different function to change the struction, like this:
Struct:
typedef struct data{
int row;
int column;
}data;
the var in the struct changer function:
struct data* init_maze(void) {
data information; //init information struct
data *infoPoint; //int information struct pointer
int row = 6;
int column = 10;
infoPoint->row = row; //not working but should be updating information
infoPoint->column = column; //same as above
return infoPoint;
}
But this is not working as intended. The code breaks and nothing happens. Could anyone please explain what I am doing wrong.