工会与工会结构...
union u
{
struct st
{
int i:4;
int j:4;
int k:4;
int l; //或int l:4
} st;
int i;
} u;
main( )
{
ui = 100;
printf("%d,%d,%d",ui,u.st。 i,u.st.l);
}
ok ...答案是100,4,0 ......
可以任何人解释程序和位字段吗?
union u
{
struct st
{
int i : 4;
int j : 4;
int k : 4;
int l; // or int l:4
}st;
int i;
}u;
main()
{
u.i = 100;
printf("%d, %d, %d",u.i, u.st.i, u.st.l);
}
ok...the answer is 100,4,0...
can anyoone explain the program and bit fields??
ch ******* @ yahoo.com < ch ******* @ yahoo.com>写道:
ch*******@yahoo.com <ch*******@yahoo.com> wrote:
union u
{
struct st
{i / 4};
int j:4;
int k:4;
int l; //或int l:4
} st;
int i;
} u;
main()
{
ui = 100;
printf("%d,%d,%d",ui,u.st.i,u.st.l);
}
好的......答案是100,4,0 ......
可以任何人解释程序和位字段吗?
union u
{
struct st
{
int i : 4;
int j : 4;
int k : 4;
int l; // or int l:4
}st;
int i;
}u;
main()
{
u.i = 100;
printf("%d, %d, %d",u.i, u.st.i, u.st.l);
}
ok...the answer is 100,4,0...
can anyoone explain the program and bit fields??
笨蛋,
你想做什么?你不断发布*错误的*
代码,而不是编译或导致未定义的行为,你期望
的人向你解释发生了什么。请给自己一本关于C的正确的b $ b教科书,并找出你为什么得到这些结果。
plonk
-
:wq
^ X ^ Cy ^ K ^ X ^ C ^ C ^ C ^ C
Chump,
What is it you are trying to do ? You keep posting *wrong* pieces of
code, not compiling or causing undefined behaviour, and you expect
people to explain you what is happening. Please get yourself a proper
textbook about C and find out for yourself why you get those results.
plonk
--
:wq
^X^Cy^K^X^C^C^C^C
我不认为上面的代码是错误的...它是正确的......所有我想要的就是学习......即使我读了数百本书,我也赢了我能够回答这些问题吗?这个问题......没有人......一切都来自
经验......如果你不喜欢我不知道答案,像我一样学习......这里有专家可以很好地回答这些问题......我正在努力
学习他们的方式想想......试着想想自己的方式......有一天,nu将会是b $ b专家......
I dont think the above code is wrong...Its correct...all I am trying to
do is learn...n even if I read hundreds of books, I won''t be able to
answer such questions....for that matter...no one...it all comes by
experience...if u don''t know the answer, learn like me...there are
experts here who can answer the questions excellently...I am trying to
learn the way they think....Just try to think their way...n u will be
expert someday....
Le 17-01-2006, ch*******@yahoo.com < ch *** ****@yahoo.com>一个écrit*:
Le 17-01-2006, ch*******@yahoo.com <ch*******@yahoo.com> a écrit*:
我不认为上面的代码是错误的......它的正确...我想要做的就是学习......即使我读了数百个书籍,
只有三本书可供阅读:
- K& R
- CA参考手册, by Harbison和Stelle
- C标准
我无法回答这些问题....
不,首先阅读2,你就可以了。
就此而言......没有人......这一切都来自经验......
No.
这里有专家可以很好地回答这些问题......
是的。但你认为他们想回答吗?
我正在努力学习他们的思维方式......
I dont think the above code is wrong...Its correct...all I am trying to
do is learn...n even if I read hundreds of books,
There a only three books to read:
- K&R
- "C A reference manual", by Harbison and Stelle
- The C standart
I won''t be able to answer such questions....
No, read the 2 first, and you will be able to.
for that matter...no one...it all comes by experience...
No.
there are
experts here who can answer the questions excellently...
Yes. But did you think they want to answer ?
I am trying to learn the way they think....
阅读好书。
Marc Boyer
Read good books.
Marc Boyer