C/C++¹Ø¼ü×Östatic,const,inline,define,typedef
C/C++¹Ø¼ü×Östatic,const,inline,define,typedef
document.body.oncopy = function() {
if (window.clipboardData) {
setTimeout(function() {
var text = clipboardData.getData("text");
if (text && text.length > 300) {
text = text + "\r\n\n±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£º" + location.href;
clipboardData.setData("text", text);
}
}, 100);
}
}
Ò»
static
1)
²úÉú±³¾°
Òý³öÔÒò£ºº¯ÊýÄÚ²¿¶¨ÒåµÄ±äÁ¿£¬ÔÚ³ÌÐòÖ´Ðе½ËüµÄ¶¨Ò崦ʱ£¬±àÒëÆ÷ΪËüÔÚÕ»ÉÏ·ÖÅä¿Õ¼ä£¬´ó¼ÒÖªµÀ£¬º¯ÊýÔÚÕ»ÉÏ·ÖÅäµÄ¿Õ¼äÔڴ˺¯ÊýÖ´ÐнáÊøʱ»áÊͷŵô£¬ÕâÑù¾Í²úÉúÁËÒ»¸öÎÊÌâ
:
Èç¹ûÏ뽫º¯ÊýÖд˱äÁ¿µÄÖµ±£´æÖÁÏÂÒ»´Îµ÷ÓÃʱ£¬ÈçºÎʵÏÖ£¿
×îÈÝÒ×Ïëµ½µÄ·½·¨ÊǶ¨ÒåÒ»¸öÈ«¾ÖµÄ±äÁ¿£¬µ«¶¨ÒåΪһ¸öÈ«¾Ö±äÁ¿ÓÐÐí¶àȱµã£¬×îÃ÷ÏÔµÄȱµãÊÇÆÆ»µÁ˴˱äÁ¿µÄ·ÃÎÊ·¶Î§£¨Ê¹µÃÔڴ˺¯ÊýÖж¨ÒåµÄ±äÁ¿£¬²»½ö½öÊܴ˺¯Êý¿ØÖÆ£©¡£
ÀàµÄ¾²Ì¬³ÉÔ±Ò²ÊÇÕâ¸öµÀÀí¡£
½â¾ö·½°¸£ºÒò´Ë
C++
ÖÐÒýÈëÁË
static
£¬ÓÃËüÀ´ÐÞÊαäÁ¿£¬ËüÄܹ»Ö¸Ê¾±àÒë
Æ÷½«´Ë±äÁ¿ÔÚ³ÌÐòµÄ¾²Ì¬´æ´¢Çø·ÖÅä¿Õ¼ä±£´æ£¬ÕâÑù¼´ÊµÏÖÁËÄ¿µÄ£¬ÓÖʹµÃ´Ë±äÁ¿µÄ´æÈ¡·¶Î§²»±ä¡£
2)
¾ßÌå×÷ÓÃ
Static
×÷Ó÷ÖÎö×ܽ᣺
static
×ÜÊÇʹµÃ±äÁ¿»ò¶ÔÏóµÄ´æ´¢ÐÎʽ±ä³É¾²Ì¬´æ´¢£¬Á¬½Ó·½Ê½±ä³ÉÄÚ²¿Á¬½Ó£¬¶ÔÓÚ¾Ö²¿±äÁ¿£¨ÒѾÊÇÄÚ²¿Á¬½ÓÁË£©£¬Ëü½ö¸Ä±äÆä´æ´¢·½Ê½£»¶ÔÓÚÈ«¾Ö±äÁ¿£¨ÒѾÊǾ²Ì¬´æ´¢ÁË£©£¬Ëü½ö¸Ä±äÆäÁ¬½ÓÀàÐÍ¡£
(1
Á¬½Ó·½Ê½£º³ÉΪÄÚ²¿Á¬½Ó£»
2
´æ´¢ÐÎʽ£º´æ·ÅÔÚ¾²Ì¬È«¾Ö´æ´¢Çø
)
¶þ
const
1)
²úÉú±³¾°
a) C++
ÓÐÒ»¸öÀàÐÍÑϸñµÄ±àÒëϵͳ£¬ÕâʹµÃ
C++
³ÌÐòµÄ´íÎóÔÚ±àÒë½×¶Î¼´¿É·¢ÏÖÐí¶à£¬´Ó¶øʹµÃ³ö´íÂÊ´óΪ¼õÉÙ£¬Òò´Ë£¬Ò²³ÉΪÁË
C++
Óë
C
Ïà±È£¬ÓÐ×ÅÍ»³öÓŵãµÄÒ»¸ö·½Ãæ¡£
b) C
Öкܳ£¼ûµÄÔ¤´¦ÀíÖ¸Áî
#define VariableName VariableVa
Ïà¹ØÎĵµ£º
ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......
/*±àд³ÌÐò£¬ÊäÈë2¸öÊýÒÔ¼°¼Ó¼õ³Ë³ýÖеÄijÔËËã·ûºÅ£¬²¢µ÷ÓÃ×Ô¼º±àдµÄº¯Êý¼ÆËãÏàÓ¦µÄ½á¹û*/
#include<stdio.h>
#include<conio.h>
float cal(int a,char sym,int b);
main()
{
int a=0,b=0;
char sym='\0';
float c=0.0;
scanf("%d%c%d",&a,&sym,&b);
c=c ......
ÔÚC/C++ÖÐÎÒÃÇÓÐʱΪÁ˽ÚÊ¡ÄÚ´æÕ¼Óÿռ䣬ÐèҪʹÓõ½Î»Óò£¬ÈçÏÂËùʾ´úÂ룺
struct SDummy
{
int A : 2;
int B : 8;
int C : 12;
int D : 10;
};
ÔÚ¼ÆËã»úÄÚ´æ°º¹óµÄÇé¿öÏ£¬Î»Óò²»·¦ÎªÒ»ÖÖÓÐЧµÄ½ÚÊ¡ÄÚ´æÕ¼ÓÿռäÓÖÈôúÂëÊéд±È½ÏͨË×Ò׶®µÄ·½·¨¡£µ«ÊÇÔÚÏÖ½ñÄÚ´æÏà ......
ÉÏ´Î×ܽáÁËC++£¨ÃæÏò¶ÔÏó£©Éè¼ÆµÄºËÐÄ˼Ï룬²¢ÇÒÀý¾ÙÁËʹÓÃÀàÄ£ÐÍÀ´Ìæ´úifºÍswitchµÄÒ»ÖÖ½ÏΪµäÐ͵ÄÇé¿ö¡£ÏÂÃæÏëÀ´Ì¸Ì¸C++ÔÚ±àÂë·½ÃæµÄÌص㡣
ÔںܶྵäµÄC++½Ì³ÌÖж¼ÓÐÒ»¸ö½¨Ò飺Ӧ¾¡Á¿Ê¹Óû§´úÂ루¿âµÄʹÓÃÕߣ©¿´ÆðÀ´¶ÌС¶ø¼òµ¥¡£°´ÕÕ³£Ê¶£¬¼òµ¥µÄ´úÂëͨ³£Òª±È´ó¶ÎµÄ´úÂëºÃÀí½â£¬¶øÓû§´úÂëͨ³£ÊµÏÖµÄÊÇ×îÉϲãµÄ¹¦ÄÜ»òÕ ......