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?

Improve company productivity with a Business Account.Sign Up

x
 
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
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.