#: 14456 S12/OS9/68000 (OSK)
01-Mar-92 22:12:03
Sb: #C help
Fm: Bob van der Poel 76510,2203
To: all
I'm not sure if what I'm trying to do is possible, but it should be .
Maybe someone with a bit more C-knowledge can help... I want to get the size of
one element of a structure. Problem is that I don't have an actual structure to
work on, just a pointer or typedef.
Assuming
typedef struct{
char a1[40];
int i1[10];
}foo;
What I'd like to do is this:
int t=sizeof(foo.a1);
Which should set t==40. I just get an error. I tried it without the typedef and
used sizeof(struct foo.a1) but got the same problem.
If you actually create storage, things work fine:
foo dummy;
int t=dummy.a1;
I've worked around this by using #define ASIZE 40 and then using this to set
the size in the struct. But there should be a way to do it my way! Any ideas?
There is 1 Reply.
|