union inside struct, how to access it?

If I have :

how do I access the char* text, inside the union of a struct? in typ?
struct data {
     int type;
     union {
        char* text;
        char* charcon;
	 char* id;
        int val;
     } d;
   } typ;

Open in new window

kuntilanakAsked:
Who is Participating?
 
Infinity08Connect With a Mentor Commented:
You'd use typ.d.text to access it.
0
 
kuntilanakAuthor Commented:
ok, thanks.. can you get to my other question about the symbol table?
0
 
Infinity08Commented:
I was already on it ;)
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
kuntilanakAuthor Commented:
thanks, hope you can reply faster :)
0
 
Infinity08Commented:
>> hope you can reply faster :)

That all depends on my availability heh. It's quite late here, and I'll head to bed soon to get up early tomorrow and go to work :) But I do my best.
0
 
kuntilanakAuthor Commented:
You're really a bunch of help really.. If I could reward you with 10k points, I would do it right now..
0
 
Infinity08Commented:
No worries. I'm just glad I can help out :)
0
All Courses

From novice to tech pro — start learning today.