¼±ÎʸöcµÄÃæÊÔÌâ
C/C++ code:
void p1(const char **pname)
{
const char *name = "test1";
*pname = name;
}
void p2(const char **pname)
{
char *name = "test2";
*pname = name;
}
void p3(const char **pname)
{
char name[] = "test3";
*pname = name;
}
int main()
{
const char *name;
p1(&name);
printf("%s\n",name);
p2(&name);
printf("%s\n",name);
p3(&name);
printf("%s\n",name);
return 0;
}
´ð°¸ÊÇ test1 ºÍ test2¶¼ÄÜ´òÓ¡³öÀ´ test3²»ÄÜ´òÓ¡ÊÇgarbage
˵string¡°test1¡±ºÍ"test2"¶¼ÊÇglobal allocated onstatant
string"test3"ÊÇÔÚstackÉϵÄ
ÎÒ¾õµÃÕâ¸ö²»¶Ô°É~~
mainÀïÃæµÄconst char*name; ¼ÈÈ»const ¶¨ÒåµÄʱºò¾ÍÓ¦¸ÃÂíÉϸ³Öµ°É~
ÎÒ¾õµÃ"test1","test2","test3" ¶¼ÊÇÔÚstackÉϵÄ
Çë¸ßÈËÖ¸µã
лл
p1 p2ÖеÄname¶¼ÊÇÖ¸Õ룬ָÏòÁ˳£Á¿×Ö·û´®£¬Õâ¸öµØÖ·ÊÇÈ«¾ÖµÄ£¬²»»áÏú»Ù¡£
p3ÖÐnameÊǸöÊý×飬ÔÚstackÖУ¬²¢Óó£Á¿×Ö·û´®¸³Öµ¡£nameµÄµØÖ·²»Êdz£Á¿×Ö·û´®µÄµØÖ·£¬ËùÒÔº¯ÊýÍ˳öºóÏú»ÙÁË¡£
ȷʵ¿ÉÒÔ´ò³öÀ´£¬Ö¸ÕënameÊÇÔÚstackÉÏ£¬µ«¡°test1","test2"ÕâЩ×Ö·û´®ÊÇÔÚ¾²Ì¬´æÖüÇø
ËùÓеÄ×Ö·û´®×ÖÃæÖµ¶¼ÊÇ·ÖÅäÔÚ³£Á¿ÇøµÄ£¬ÕâÈý¸ö¶¼ÊÇÔÚ³£Á¿ÇøµÄ£¬Ç°Á½¸öÊǶ¨ÒåÖ¸ÕëÖ±½ÓÖ¸ÏòÕâ¿é³£Á¿Çø£¬ËùÒÔÄÜ´ò³öÀ´£¬µÚÈý¸öÊÇÏÈ·ÖÅäÒ»¸öÊý×éÈ»º
Ïà¹ØÎÊ´ð£º
±àÒëÆÕͨµÄcûÎÊÌâ°¡£¬µ«±àÒëjavahÉú³ÉµÄ¾Í±¨´í£º
gcc -O0 -g3 -Wall -c -fmessage-length=0 -oHelloWorld.o ..\HelloWorld.c
gcc -otest.exe HelloWorld.o
d:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../. ......
ÎÒ¸öÈ˸оõÓеĵط½Ã»±ØÒª¿´£¬·±ËöµÃºÝ£¬ÓÃ×Ô¼º×ܽáµÄ·½·¨¸üºÃ£¬´ó¼Ò˵˵×Ô¼ºµÄÒâ¼û
ÎҸоõ±ã½Ý¼ÆËãÓë²»¶Ô³Æ±ß½çÍêÈ«¸ù¾Ý×Ô¼ºµÄ¾ÑéÀ´£¬Óò»×Å¿´Å¶£¬´ó¼Ò˵˵
Äã¿´²»¿´ÄÇÊÇÄãµÄÊÂ
Æäʵ¶¼ÊÇ»ù´¡µÄ¶«Î÷À²
......
Çë¸÷λ´óÏÀÏêϸ½²½âÒ»ÏÂÔÚVBAÖÐSUM(R[-11]C:R[-1]C)µÄ¾ßÌ庬ÒåºÍÓ÷¨£¬ÎÒÏë°ÑÀïÃæµÄ11»»³É±äÁ¿Ôõô°ì£¿
ÇóÒ»¸ö·¶Î§ÖеÄÊý¾ÝµÄºÍ,µ«ÕâÀïÃæµÄÕâ¸ö·¶Î§R[-11]C:R[-1]C...,µÚ1ÐÐCÁÐÖÁÿ11ÐÐCÁÐ?
ûÕâÑùÓùý...
......
¸Õ¸ÕÄǸöÔõô±»½áÌùÁ˰¡£¬ÄÇÎÒÀ´¿ª¸ö°É¡£
C/C++ code:
char a='s';
char str[8]="Hello123";
printf("%c", a); //»¹ÊÇS£¬ÎªÊ²Ã´£¿
printf("\n%08X %0 ......
ÈçºÎÓÃcʵÏÖ×Ô¶¯µÄtelnet¹¦ÄÜ,ÓÐËÖªµÀÔõôÓÃcÓïÑÔÀ´ÊµÏÖ¡£ÎÊÌâÖ÷ÒªÊÇtelnetµÄÓû§Ãû£¬ÃÜÂëÒª½»»¥Ê½µÄÊäÈ룬ÔõôÄܹ»ÓóÌÐòʵÏÖ°¡£¬¸ßÊÖÖ¸½Ì°¡
ÎÒÓÐÔ´Âë ÄãÒªµÄ»° ÁôÏÂÓÊÏä
flynecnt@qq.com ллÁË
liuzhizu1 ......