how to access data from structures

Hi all

i have 2 typedef structs
typedef struct
{
int a;
int offset;
int first_val;
int incr;
} offset_t;

typedef struct
{
int array[20];
int cnt;
offset_t time_offset;
} data_t;

now i have a pointer of type data_t which is
data_t *ptr;

i know to access the element timing_offset i have to do this
ptr->time_offset

but how exactly to i acces the elements in the offset_t struct using the same pointer?

Is it possible to do this
ptr->time_offset->first_val?? (i kno it might look stupid..but beginner here..dont laugh)

-thanx
ptr->time_offset.first_val

btw, offset_t is already a standard type, you might want to consider renaming yours.

also, in C++ do

struct offset_t {
// stuff here
};

instead of the typedef thing.

Topic archived. No new replies allowed.