C ³ÌÐòÎÊÌâ (Èý) - C/C++ / CÓïÑÔ
ÎÊÌâÒ»£º
ÔÚ¶ÔÆëΪ4µÄÇé¿öÏÂ
struct BBB
{
long num£»
char *name;
short int data;
char ha;
short ba[5];
}*p;
p=0x1000000;
p+0x200=____;
(Ulong)p+0x200=____;
(char*)p+0x200=____;
¼ÙÉèÔÚ32λCPUÉÏ£¬
sizeof(long) = 4 bytes
sizeof(char *) = 4 bytes
sizeof(short int) = sizeof(short) = 2 bytes
sizeof(char) = 1 bytes
ÎÊÌâ¶þ£º
´úÂ룺
void print_array()
{
int num_array[5] = {5,7,2,3,9};
a = num_array;
int i = 0;
while(i<5)
{
printf("%d\n", *a++);
i++;
}
i = 0;
while(i<5)
{
printf("%d\n", *(a+i));
i++;
}
};
½á¹û£º£¨´òÓ¡³ö£©
5
7
2
3
9
1245056
4198676
1244940
2367460
1243068
ÎÊÌ⣺Ϊʲôµ±i=0£¬1£¬2£¬3£¬4µÄʱºò£¬*(a+i)ºÍ*a++(Á¬ÐøÑ»·5´Î)½á¹û²»Ò»ÖÂÄØ£¿ÔÒòÔÚÄÄÀïÄØ£¿Çë¸ßÊÖÖ¸µã¡£Ð»Ð»£¡£¡£¡
²»ºÃÒâ˼£¬¸÷λ¡£
a = num_array; д´íÁË
Ó¦¸ÃÊÇ int *a = num_array;
ÎÊÌâ¶þ£º
i = 0;
a = num_array; // ¼ÓÉÏÕâÒ»Ðнá¹û¾ÍÒ»ÖÂÁË
while(i <5)
{
printf("%d\n", *(a+i));
ÎÊÌâ¶þ£º *a++ÄǸöÑ»·Ö®ºó£¬aÒѾ±»Òƶ¯µ½num_arrayµÄºó±ßÈ¥ÁË
ÎÊÌâÒ»£º
(Ulong)p+0x200= 0x1000200; p±»×ª»»³ÉÕûÊý£¬ËùÒÔ°´ÕÕÕûÊý×ö¼Ó·¨
(char*)p+0x200= 0x1000200; p±»×ª»»³ÉcharÖ¸Õ룬sizeof(char)ÊÇ1
p+0x200= (unsigned long)0x100000
Ïà¹ØÎÊ´ð£º
QQȺ 29152388
ÓÑÇéUP
°ï¶¥
up
°ïup
up Ö§³Ö£¡
up jf
...ÄѵÀÓзÖ..?
up up up
Ï£ÍûÓеüӷ֣¬¹þ¹þ¡£
Ö§³Ö£¬ÎÒ¼ÓÁË£¬Ï£ÍûÂ¥Ö÷ÄܼÓÎÒ£¬¹²Í¬Ñ§Ï°¹þ
¼ÓÁË¡£
¶¥ÉÏ£¬Ã¿ÌìÊÕ»ñÒ»µã£¬Ö§³Ö ......
Ä¿Ç°Óöµ½µÄÎÊÌâÊÇ£º
´æ·ÅÔÚÔ¶³Ì·þÎñÆ÷¶Ëc/s³ÌÐòÒ»ÓиüУ¬ÈçºÎ×öµ½¿Í»§¶ËÁ¢¼´ÏìÓ¦µ¯³öÓÐ×îÐÂÉý¼¶µÄÌáʾ´°¿Ú¡£
±¾À´Óеã˼·£º²ÉÓÃWCF+windowns·þÎñ+¶¨Ê±Æ÷µÄ·½Ê½Ò²ÄÜʵÏÖ£¬µ«ÊÇÿ̨¿Í»§¶Ë»ú×Óÿ¸ô¶¼È¥·ÃÎÊÒ»ÏÂÔ¶³Ì ......
ÎÊÌâ:¹¤µØÉÏÐèÒª³¤¶ÈΪA1µÄ¸Ö½îX¸ù,³¤¶ÈΪA2µÄ¸Ö½îY¸ù,³¤¶ÈΪA3µÄ¸Ö½îZ¸ù......ÒÔ´ÎÀàÍÆ.
ÆäÖÐA1,A2,A3,...³¤¶ÈÈÎÒâÖ¸¶¨,X,Y,Z,...ÊýÁ¿Ò²ÈÎÒâÖ¸¶¨.
µ«²Ö¿âÖеĸֽîΪ±ê×¼³¤¶È,Ö»ÓÐ9Ã׺Í15Ã×Á½ÖÖ³¤¶È,ÊýÁ¿² ......
×î½üÔÚ¿´Ò»¸öÓÃbisonʵÏÖµÄC parser,OSÊÇopensolaris¡£µ±ÓÃËüÀ´½âÎöÒ»¸ö¼òµ¥µÄhello.cʱ£¬³öÏÖ¡°/usr/include/sys/va_list.h: parse error before __gnuc_va_list¡±¡£´ò¿ªÎļþva_list.hºó·¢ÏÖÕâÑùÒ»ÐС°typedef __bu ......