problem with unions (query)
K. Richard Magill
rich at hal.UUCP
Thu Jun 5 01:51:00 AEST 1986
I have a problem saying what I want to say. The basics look like:
(vax 4.2)
typedef union {
char *c;
int *i;
} U;
U f()
{
return("mumble");
}
Which naturally is of the wrong type but casting the (char *) into
(U) doesn't work either. This works but is ucky and -O doesn't rip out "one".
U f()
{
U one;
one.c = "mumble";
return(one);
}
Am I missing something obvious?
K. Richard Magill
...decvax!cwruecmp!hal!rich
More information about the Comp.lang.c
mailing list