Solved

union inside struct, how to access it?

Posted on 2008-10-15
7
1,263 Views
Last Modified: 2008-10-16
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

0
Comment
Question by:kuntilanak
  • 4
  • 3
7 Comments
 
LVL 53

Accepted Solution

by:
Infinity08 earned 500 total points
Comment Utility
You'd use typ.d.text to access it.
0
 

Author Comment

by:kuntilanak
Comment Utility
ok, thanks.. can you get to my other question about the symbol table?
0
 
LVL 53

Expert Comment

by:Infinity08
Comment Utility
I was already on it ;)
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:kuntilanak
Comment Utility
thanks, hope you can reply faster :)
0
 
LVL 53

Expert Comment

by:Infinity08
Comment Utility
>> 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
 

Author Comment

by:kuntilanak
Comment Utility
You're really a bunch of help really.. If I could reward you with 10k points, I would do it right now..
0
 
LVL 53

Expert Comment

by:Infinity08
Comment Utility
No worries. I'm just glad I can help out :)
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now