union

N

newbai

union
{
int ival;
char ival;
}u;
main()
{
u={1,'2'};
printf("%d",sizeof(u));
}

can someonw help me in knowing how to do this?
 
K

Keith Thompson

newbai said:
union
{
int ival;
char ival;
}u;
main()
{
u={1,'2'};
printf("%d",sizeof(u));
}

can someonw help me in knowing how to do this?

First, you posted the exact same article three times. Please don't do
that. (Apparently Google somehow makes it easy to make this mistake.)

Knowing how to do what? There are some errors in your program
(missing "#include <stdio.h>", "main()" should be "int main(void)",
the result of the sizeof should be cast to int for use with "%d"), but
apart from that I don't know what you're asking.
 
S

santosh

Keith said:
First, you posted the exact same article three times. Please don't do
that. (Apparently Google somehow makes it easy to make this mistake.)

<snip>

Rarely, it, (Google Groups), reports a posting failure while the post
had actually succeeded. The unassuming poster then retries, thus
posting twice, or more.

Whenever such an "error" is reported, I actually check the thread,
after a gap of a few minutes, to make sure that post hasn't silently
succeeded, before attempting to post again. Many posters don't bother
to take this much trouble.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top