C/C++ÖÐÖ¸Õë¼Ó 1 µÄÎÊÌâ
ÏÈÓñ´¶ûµÄÒ»µÀ±ÊÊÔÌâ¼òÒªµÄ˵Ã÷һϰɣº
¡¾Ì⡿˵Ã÷ÒÔϳÌÐò¡£
#include
int main(void)
{
unsigned int a[3] = {0x01020304, 0x05060708, 0x090a0b0c};
unsigned int *p = (unsigned int *)((int)a +1);¢Ù
printf("%x\n", *p);
return 0;
}
¡¾ÌâÄ¿½âÎö¡¿
Õâ¶Î³ÌÐòµÄÊä³ö½á¹ûÓ¦¸ÃÊÇ 8010203£¨¼´0x08010203£©¡£
ÄÚ´æ´æ´¢½á¹¹È磨ͼ1£©Ëùʾ£¨ÔÚ big-endian µÄϵͳÖУ©¡£ÔÚ¢Ù´¦µÄÓï¾äÖУ¬Ê×ÏÈ°ÑÊý×é a µÄÊ×µØַת»¯ÎªÕûÐÍ£¬È»ºóÔÙ¼Ó 1 £¬ÔÙÇ¿ÖÆת»¯Îª (unsigned int *) ,Õâ¸öʱºò p ÖµÓ¦¸ÃÊÇ 0x1235£¬ËùÒÔÈ¡µÄÊÇ´Ó 0x1235 µ½ 0x1238 Ëĸö×Ö½Ú×é³ÉµÄеÄÕûÊý£¬ËùÒÔ¾ÍÊÇ 0x08010203¡£
¸ø³ö¹«Ê½µÄ»°¾ÍÊÇ (a[0]>>8 | a[1]
Ïà¹ØÎĵµ£º
ÍøÓѹ۵ã:
(Ò»):
ÎÒÈÏΪºÜ¶àÈËûÓÐÀí½âlinus»òÕßmyanµÄÒâ˼£¬ÎÒ¾Ù¸öʵÀý¡£
ÎÒÃÇÏÖÔÚÒªÉè¼ÆÒ»Ì×ÍøÂ磿ͻ§¶ËÈí¼þ£¬ÎÒÃÇÒªÏÈ°ÑÐÒ鶨ºÃ£¬°Ñ½çÃæºÍºǫ́½»»¥Éè¼ÆÏëºÃ£¬°ÑÈÝ´íºÍ»Ö¸´ÏëºÃ£¬ÎÒÈÏΪÕâЩÊÇ×îÖØÒªµÄ£¬ÖÁÓÚ±àÂ룬ÓÃCÒ²¿ÉÒÔ±à³öÀ´£¬ÓÃC£«£«Ò²¿ÉÒÔ±à³öÀ´£¬ÉõÖÁÓÃJAVAÒ²Äܱà³öÀ´£¬¹Ø¼üÊÇÕû¸öÈí¼þµÄ¼Ü¹¹ÒªÇåÎú£¬Õ ......
CÓïÑԵıê×¼¿âº¯Êý°üÀ¨Ò»ÏµÁÐÈÕÆÚºÍʱ¼ä´¦Àíº¯Êý£¬ËüÃǶ¼ÔÚÍ·ÎļþÖÐ˵Ã÷¡£ÏÂÃæÁгöÁËÕâЩº¯Êý¡£ÔÚÍ·ÎļþÖж¨ÒåÁËÈýÖÖÀàÐÍ£ºtime_t£¬struct tmºÍclock_t¡£
ÔÚÖÐ˵Ã÷µÄCÓïÑÔʱ¼äº¯Êý & ......
תע:
½ñÌìÓÐÍøÓÑÎʵ½Õâ¸öÎÊÌâ,ÓÚÊÇÔÚÍøÉÏËÑË÷ÁËÒ»ÏÂ,תÌùÕâ´Ë.
ÏàËƵÄÌ«¶àÁË,³ö´¦²»Ïê.Ôڴ˸ÐлÔ×÷Õß¾«²Ê½²½â.
Ò»¡¢Ô¤±¸ÖªÊ¶—³ÌÐòµÄÄÚ´æ·ÖÅä
Ò»¸öÓÉc/C++±àÒëµÄ³ÌÐòÕ¼ÓõÄÄÚ´æ·ÖΪÒÔϼ¸¸ö²¿·Ö
1¡¢Õ»Çø£¨stack£©— ÓɱàÒëÆ÷×Ô¶¯·ÖÅäÊÍ·Å £¬´æ·Åº¯ÊýµÄ²ÎÊýÖµ£¬¾Ö²¿±äÁ¿µÄÖµµÈ¡£Æä²Ù×÷·½Ê½Àà ......