K
K
kenny1822017-03-02 19:33:26
C++ / C#
kenny182, 2017-03-02 19:33:26

How to deal with pointers hidden deep in C structures?

There is a struct which has a struct which has a struct ... which has a struct which has a pointer to an unsigned char array. I create a pointer to this structure. How to pass, for example, to unsigned char* adress the address of the first element of this array? Will the value in adress change to the address of the next array element if I write *adress++?
For example:

struct struct1{
int a;
int b;
struct2 *st;
} 

struct struct2{
int a;
int b;
struct3 *st;
} 

struct struct3{
int a;
int b;
struct4 *st;
} 

struct struct4{
int a;
unsigned char* mas;
}

and so I will create unsigned char* adress and struct1* st. How can I pass the address of mas to adress? And, taking this opportunity, how do I get the value that is at the address in mas?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question