Solved

union inside struct, how to access it?

Posted on 2008-10-15
7
1,302 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 53

Accepted Solution

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

Author Comment

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

Expert Comment

by:Infinity08
ID: 22725548
I was already on it ;)
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

Author Comment

by:kuntilanak
ID: 22725616
thanks, hope you can reply faster :)
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 22725736
>> 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
ID: 22725783
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
ID: 22726214
No worries. I'm just glad I can help out :)
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

691 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