Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

union inside struct, how to access it?

Posted on 2008-10-15
7
Medium Priority
?
1,319 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 2000 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
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…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

783 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