将char *转换为int * [英] Casting char* to int*
问题描述
char * pch [120];
//我们应该检查
// if((size_t)pch& 3)== 0)
//在以下声明之前?
int * pint =(int *)pch;
Alex Vinokur
电子邮件:alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn
char* pch [120];
// Should we check
// if (((size_t) pch & 3) == 0)
// before the following statement ?
int* pint = (int*) pch;
Alex Vinokur
email: alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn
推荐答案
Alex Vinokur说:
Alex Vinokur said:
char * pch [120];
//我们应该检查
// if(((size_t)pch & 3)== 0)
//在以下语句之前?
int * pint =(int *)pch;
char* pch [120];
// Should we check
// if (((size_t) pch & 3) == 0)
// before the following statement ?
int* pint = (int*) pch;
演员阵容没有意义,作业也是如此。
不要这样做。
< br $>
-
Richard Heathfield< http://www.cpax.org.uk>
电子邮件:-http:// www。 + rjh @
谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php>
Usenet是一个奇怪的放置" - dmr 1999年7月29日
The cast is meaningless, as is the assignment.
Don''t Do That.
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Alex Vinokur写道:
Alex Vinokur wrote:
char * pch [120];
//我们应该检查
// if((size_t)pch& 3)== 0)
//之前以下陈述?
int * pint =(int *)pch;
char* pch [120];
// Should we check
// if (((size_t) pch & 3) == 0)
// before the following statement ?
int* pint = (int*) pch;
不,我们根本不应该做任务。或者,就此而言,if。
来想一想,调用变量`pch`看起来有点奇怪。我假设
,`pint`是一个变量来应对transAtlantic变异?
-
克里斯喝一半无论如何" Dollin
Hewlett-Packard Limited注册办公室:Cain Road,Bracknell,
注册号:690597 England Berks RG12 1HN
No, we simply shouldn''t do the assignment. Or, for that matter, the if.
Come to think of it, calling a variable `pch` looks a bit odd. I assume
that `pint` is a variable to cope with transAtlantic variation?
--
Chris "drinks halves anyway" Dollin
Hewlett-Packard Limited registered office: Cain Road, Bracknell,
registered no: 690597 England Berks RG12 1HN
11月16日上午11:32,Alex Vinokur< ale ... @ users.sourceforge.net>
写道:
On Nov 16, 11:32 am, Alex Vinokur <ale...@users.sourceforge.net>
wrote:
char * pch [120];
//我们应该检查
// if((size_t) pch& 3)== 0)
//在下面的语句之前?
int * pint =(int *)pch;
char* pch [120];
// Should we check
// if (((size_t) pch & 3) == 0)
// before the following statement ?
int* pint = (int*) pch;
对不起,应该是:
char pch [120];
//我们应该检查
// if((size_t)pch& 3)== 0)
//在以下语句之前?
int * pint = (int *)pch;
Alex Vinokur
电子邮件:alex DOT vinokur AT gmail DOT com
http://mathforum.org/libr ary / view / 10978.html
http://sourceforge.net / users / alexvn
Sorry, should be:
char pch [120];
// Should we check
// if (((size_t) pch & 3) == 0)
// before the following statement ?
int* pint = (int*) pch;
Alex Vinokur
email: alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn
这篇关于将char *转换为int *的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!