Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

c/c++ static

C++µÄstaticÓÐÁ½ÖÖÓ÷¨£ºÃæÏò¹ý³Ì³ÌÐòÉè¼ÆÖеÄstaticºÍÃæÏò¶ÔÏó³ÌÐòÉè¼ÆÖеÄstatic¡£Ç°ÕßÓ¦ÓÃÓÚÆÕͨ±äÁ¿ºÍº¯Êý£¬²»Éæ¼°ÀࣻºóÕßÖ÷Ҫ˵Ã÷staticÔÚÀàÖеÄ×÷Óá£
Ò»¡¢ÃæÏò¹ý³ÌÉè¼ÆÖеÄstatic
1¡¢¾²Ì¬È«¾Ö±äÁ¿
ÔÚÈ«¾Ö±äÁ¿Ç°£¬¼ÓÉϹؼü×Östatic£¬¸Ã±äÁ¿¾Í±»¶¨Òå³ÉΪһ¸ö¾²Ì¬È«¾Ö±äÁ¿¡£ÎÒÃÇÏȾÙÒ»¸ö¾²Ì¬È«¾Ö±äÁ¿µÄÀý×Ó£¬ÈçÏ£º
//Example 1
#include <iostream.h>
void fn();
static int n; //¶¨Ò徲̬ȫ¾Ö±äÁ¿
void main()
{
n=20;
cout<<n<<endl;
fn();
}
void fn()
{
n++;
cout<<n<<endl;
}
¾²Ì¬È«¾Ö±äÁ¿ÓÐÒÔÏÂÌص㣺
¸Ã±äÁ¿ÔÚÈ«¾ÖÊý¾ÝÇø·ÖÅäÄڴ棻
δ¾­³õʼ»¯µÄ¾²Ì¬È«¾Ö±äÁ¿»á±»³ÌÐò×Ô¶¯³õʼ»¯Îª0£¨×Ô¶¯±äÁ¿µÄÖµÊÇËæ»úµÄ£¬³ý·ÇËü±»ÏÔʽ³õʼ»¯£©£»
¾²Ì¬È«¾Ö±äÁ¿ÔÚÉùÃ÷ËüµÄÕû¸öÎļþ¶¼ÊǿɼûµÄ£¬¶øÔÚÎļþÖ®ÍâÊDz»¿É¼ûµÄ£»¡¡
¾²Ì¬±äÁ¿¶¼ÔÚÈ«¾ÖÊý¾ÝÇø·ÖÅäÄڴ棬°üÀ¨ºóÃ潫ҪÌáµ½µÄ¾²Ì¬¾Ö²¿±äÁ¿¡£¶ÔÓÚÒ»¸öÍêÕûµÄ³ÌÐò£¬ÔÚÄÚ´æÖеķֲ¼Çé¿öÈçÏÂͼ£º
¡¡
´úÂëÇø
È«¾ÖÊý¾ÝÇø
¶ÑÇø
Õ»Çø
¡¡¡¡Ò»°ã³ÌÐòµÄÓÉnew²úÉúµÄ¶¯Ì¬Êý¾Ý´æ·ÅÔÚ¶ÑÇø£¬º¯ÊýÄÚ²¿µÄ×Ô¶¯±äÁ¿´æ·ÅÔÚÕ»Çø¡£×Ô¶¯±äÁ¿Ò»°ã»áËæן¯ÊýµÄÍ˳ö¶øÊͷſռ䣬¾²Ì¬Êý¾Ý£¨¼´Ê¹ÊǺ¯ÊýÄÚ²¿µÄ¾²Ì¬¾Ö²¿±äÁ¿£©Ò²´æ·ÅÔÚÈ«¾ÖÊý¾ÝÇø¡£È«¾ÖÊý¾ÝÇøµÄÊý¾Ý²¢²»»áÒòΪº¯ÊýµÄÍ˳ö¶øÊͷſռ䡣ϸÐĵĶÁÕß¿ÉÄܻᷢÏÖ£¬Example 1ÖеĴúÂëÖн«
static int n; //¶¨Ò徲̬ȫ¾Ö±äÁ¿
¸ÄΪ
int n; //¶¨ÒåÈ«¾Ö±äÁ¿
³ÌÐòÕÕÑùÕý³£ÔËÐС£
µÄÈ·£¬¶¨ÒåÈ«¾Ö±äÁ¿¾Í¿ÉÒÔʵÏÖ±äÁ¿ÔÚÎļþÖеĹ²Ïí£¬µ«¶¨Ò徲̬ȫ¾Ö±äÁ¿»¹ÓÐÒÔϺô¦£º
¾²Ì¬È«¾Ö±äÁ¿²»Äܱ»ÆäËüÎļþËùÓã»
ÆäËüÎļþÖпÉÒÔ¶¨ÒåÏàͬÃû×ֵıäÁ¿£¬²»»á·¢Éú³åÍ»£»
Äú¿ÉÒÔ½«ÉÏÊöʾÀý´úÂë¸ÄΪÈçÏ£º
//Example 2
//File1
#include <iostream.h>
void fn();
static int n; //¶¨Ò徲̬ȫ¾Ö±äÁ¿
void main()
{
n=20;
cout<<n<<endl;
fn();
}
//File2
#include <iostream.h>
extern int n;
void fn()
{
n++;
cout<<n<<endl;
}
±àÒë²¢ÔËÐÐExample 2£¬Äú¾Í»á·¢ÏÖÉÏÊö´úÂë¿ÉÒÔ·Ö±ðͨ¹ý±àÒ룬µ«ÔËÐÐʱ³öÏÖ´íÎó¡£ÊÔ׎«
static int n; //¶¨Ò徲̬ȫ¾Ö±äÁ¿
¸ÄΪ
int n; //¶¨ÒåÈ«¾Ö±äÁ¿
ÔٴαàÒëÔËÐгÌÐò£¬Ï¸ÐÄÌå»áÈ«¾Ö±äÁ¿ºÍ¾²Ì¬È«¾Ö±äÁ¿µÄÇø±ð¡£
2¡¢¾²Ì¬¾Ö²¿±äÁ¿
ÔÚ¾Ö²¿±äÁ¿Ç°£¬¼ÓÉϹؼü×Östatic£¬¸Ã±äÁ¿¾Í±»¶¨Òå³ÉΪһ¸ö¾²Ì¬¾Ö²¿±äÁ¿¡£
ÎÒÃ


Ïà¹ØÎĵµ£º

º½¿Õ¹«Ë¾¹ÜÀíϵͳ(VC++ ÓëSQL 2005)

ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
      ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......

¡¾C\C++ÓïÑÔÈëÃÅƪ¡¿ »ù±¾Êý¾ÝÀàÐÍ

Ê×ÏÈ¡¢ÎÒÃÇ¿´32λµÄÕûÊý£ºint ¡¢unsigned int¡¢long¡¢unsigned long ¡£ÕâЩ¶¼ÊÇ»ù±¾ÀàÐÍ£¬Ã»ÓÐunsigned¹Ø¼ü×ÖµÄÊÇÓзûºÅµÄ£¬·´Ö®ÊÇÎÞ·ûºÅµÄ¡£»¹ÓбÈÈçDWORD¡¢ UINTÕâЩҲֻÊÇд±ðÃû£¨typedef£©¶øÒÑ¡£ÓзûºÅÕûÊýÖµµÃ×¢ÒâµÄÊÇʲô·¶Î§ÄÚÊÇÕýÊý£¬Ê²Ã´·¶Î§ÊǸºÊý¡£ÕâÑù¶ÔÓÚ¼Ó¼õÔËËã¡¢±È½ÏÔËËãµÈÓкܴó°ïÖú£¬·ñÔòºÜÈÝÒ×Òç³ö»òÕß± ......

50¸öc/c++Ô´´úÂëÍøÕ¾[ת]

C/C++ÊÇ×îÖ÷ÒªµÄ±à³ÌÓïÑÔ¡£ÕâÀïÁгöÁË50ÃûÓÅÐãÍøÕ¾ºÍÍøÒ³Çåµ¥£¬ÕâЩÍøÕ¾Ìṩc/c++Ô´´úÂë¡£Õâ·ÝÇåµ¥ÌṩÁËÔ´´úÂëµÄÁ´½ÓÒÔ¼°ËüÃǵÄС˵Ã÷¡£ÎÒÒѾ¡Á¦°üÀ¨×î¼ÑµÄC/C++Ô´´úÂëµÄÍøÕ¾¡£Õâ²»ÊÇÒ»¸öÍêÕûµÄÇåµ¥£¬ÄúÓн¨Òé¿ÉÒÔÁªÏµÎÒ£¬ÎÒ½«»¶Ó­ÄúµÄ½¨Ò飬ÒÔ½øÒ»²½¼ÓÇ¿Õâ·½ÃæµÄÇåµ¥¡£
1¡¢http://snippets.dzone.com/tag/c/ --ÊýÒÔǧ¼Æ ......

ARM+LinuxÖÐÎÞ·¨ÏìÓ¦ctrl+cÊÇÔõô»ØÊÂ

µ½×îºó»¹ÊÇ×Ô¼º½â¾öÁË£¬µ¼Ö¸ÃÎÊÌâµÄÔ­ÒòÊÇÔÚlinuxÆô¶¯µ½×îºó³öÏÖ£º
/bin/sh: can't access tty; job control turned off
¶ø³öÏָôíÎóµÄÔ­ÒòºÍ½â¾ö·½·¨googleºóÓÐǧ°ÙÖÖ£¬³¢ÊÔÁ˺ܶàÖÖ¶¼Ã»ÓаïÎÒ½â¾öÎÊÌâ¡£
ÏÂÃæÊÇÎÒ×Ô¼ºµÄ½â¾ö·½·¨£º
1. vi /etc/inittab µÚÒ»ÐÐÌí¼Ó
    console::sysinit:/etc/init.d ......

´ÓC++µ½JAVA£¬C++³ÌÐòԱѧϰJAVAµÄÖ¸ÄÏ

write by ¾ÅÌìÑãôá(JTianLing) -- blog.csdn.net/vagrxie
ÌÖÂÛÐÂÎÅ×é¼°Îļþ
Technorati ±êÇ©: JAVA
,C++
,Python
JAVA is not just another programming language. -- ÄäÃû
ѧϰ¸üеÄÓïÑÔ£¬ÓÐÖúÓÚÁ˽â±ðÈ˶ԾÉÓïÑÔÓÐÄÄЩ²»Âú¡£ -- ÄäÃû
 
Ç°ÑÔ
ÏÈ
˵Ã÷±¾ÎĵÄÐÐÎÄÏ°¹ß£¬ÎÄÕÂд×÷Á÷³ÌÒÔ±¾ÈËÔĶÁ¡¶Java Progra ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ