¡¾C\C++ÓïÑÔÈëÃÅƪ¡¿ ½á¹¹Ìå
Ç°ÃæÁ½Æª»ù±¾°ÑÖ¸Õë¸ø½éÉÜÍêÁË£¬ÏàÐÅ´ó¼Ò¶ÔÖ¸ÕëÒѾ²»ÊÇÄÇôİÉúÁË¡£Ò²²»»áÒòΪָÕëºÍÊý×éÖ®¼äµÄ¹Øϵ¶øµ¼Ö»ìÏýÁË¡£´ó¼Ò¿ÉÄÜÒ²ÆȲ»¼°´ýÏëÁ˽âϺóÀ´µÄ֪ʶ¡£½ñÌìÎÒÃǾͽéÉÜϽṹÌå¡£
¶ÔÓڽṹÌ壬¼ÈÈ»½Ð½á¹¹Ì壬ÐÎÏóÉÏÎÒÃÇ¿ÉÒÔÀí½âÆä¾ÍÊÇÒ»¶ÑÊý¾Ý¼¯ºÏÔÚÒ»ÆðÐγÉÒ»¸ö½á¹¹¡£¾Í±ÈÈçÒ»¸öѧÉúµÄÐÅÏ¢°üÀ¨£ºÑ§ºÅ¡¢ÐÕÃû¡¢°à¼¶¡¢ÄêÁäµÈµÈ¡£ÕâЩÐÅÏ¢¶¼ÊÇÊôÓÚÕâ¸öѧÉúµÄ£¬Òò´ËÎÒÃǾͿÉÒÔ½«ÕâЩÐÅϢͳһ°ó¶¨ÔÚÒ»Æð¡£ÐγÉÒ»¸öѧÉúʵÌ壬ÕâÀïÓеãC++µÄζµÀ¡£ÎÒÃÇѧCÒ²»¹ÊÇÓбØÒªÕâÑù˼¿¼¡£ÔÚÎÒÃÇÖÜΧ¼¸ºõÿһÑù¶«Î÷¶¼ÓÐËü×Ô¼ºµÄÐÅÏ¢»òÕß×é³É¡£±ÈÈçÒ©Æ·£¬ËüÓÐʲô¹¦Ð§£¬ÓÐʲô³É·ÖµÈµÈ¶¼ÄÜͳһ°ó¶¨ÔÚÒ»ÆðÐγÉÒ»¸öʵÌ壬ÎÒÃÇÔÚ³ÌÐòÖоÍÄÜ·½±ãµÄ·ÃÎÊÕâЩʵÌåµÄÿһ¸öÐÅÏ¢»ò×é³É¡£Òò´Ë£¬µ±ÎÒÃÇÔÚÉè¼ÆÒ»¸ö³ÌÐòµÄʱºò£¬ÎÒÃǾÍÄÜ°ÑһЩ¾ßÓй²Í¬ÌØÐÔ»òÕß×é³ÉÔªËؼ¯ºÏµ½Ò»Æð¹¹³ÉÒ»¸ö½á¹¹Ìå¡£±ÈÈçÎÒÃǵÄѧÉú¾Í¿ÉÒÔд³É£º
struct SStudent
{
char name[ 13 ]; // ÐÕÃû
char className[ 16 ]; // °à¼¶Ãû
char age; // ÄêÁä
....
};
ÕâÑùÒ»À´£¬Ñ§ÉúÕâ¸ö»îÉúÉúµÄʵÌå¾Í°ÑËùÓйØÓÚËûµÄÐÅÏ¢¼¯ÖÐÔÚÒ»ÆðÁË¡£ÕâÑù¾ÍÄܼ¯ÖйÜÀíÁË£¬ÀïÃæµÄÿһ¸öÐÅÏ¢¾ÍÄÜͨ¹ý½á¹¹Ìå±äÁ¿À´·ÃÎÊ¡£ÏÈ¿´¿´Ôõô·ÃÎÊ£º
C
struct SStudent student;
student.age = 22;
C++£º
SStudent student;
student.age = 22;
´ÓÉÏÃæ¿ÉÒÔ¿´³öÒª·ÃÎÊÒ»¸ö½á¹¹Ìå³ÉÔ±ÊǺܷ½±ãµÄ£¬Í¬Ê±Ò²ÌåÏÖÁËʵÌåµÄ¸ÅÄî¡£ÎÒÃǽ«Ñ§ÉúʵÌåµÄÄêÁäÐÅϢȡ³öÀ´¸³ÖµÎª22Ëê¡£¾ÍºÃÏñÔÚʹÓÃij¸ö¶«Î÷µÄij¸ö¹¦ÄÜÒ»Ñù¡£ÕâÒ²ÊÇÖÚ¶àÃæÏò¶ÔÏóÓïÑÔµÄÒ»ÖÖ˼Ïë¡£¾ÍÊǽ«³ÌÐòÊý¾Ý·â×°»°¡¢½á¹¹»¯£¬ÎÒÃÇÒª²Ù×÷Ò»¸öÊý¾Ý¾Í¸úÏÖʵÉú»îÖеÄʹÓÃij¸ö¹¤¾ßµÄij¸ö¹¦ÄÜÒ»Ñù¡£ÎÒÃÇ¿´µ½ÉÏÃæCºÍC++°æ±¾·ÃÎÊΨһ²»Í¬µÄ¾ÍÊÇC++°æ±¾ÔÚÉùÃ÷½á¹¹Ìå±äÁ¿µÄʱºò²»ÐèÒªÔÚÇ°Ãæ¼ÓÉÏstruct¹Ø¼ü×Ö£¬¸öÈ˾õµÃºóÀ´C++¾õµÃs
Ïà¹ØÎĵµ£º
ÆäʵVIMÒ²ÄܰѱàÒë µ÷ÊÔ¼¯³ÉÔÚÒ»Æð£¬ÏñÊÇÒ»¸öIDEÒ»Ñù¡£
Ê×ÏÈÏÖÔÚVIMµÄÔ´Â룬ÒòΪҪ¼¯³Éµ÷ÊÔ»·¾³µÄ»°ÐèÒªÖØбàÒëVIM²ÅÐУ¬ËùÒÔÎÒÃDz»ÈçÖØа²×°Ò»¸ö¡£
VIMµÄÏÖÔÚµØÖ·£º
http://www.vim.org/sources.php
È»ºóÏÂÔØVIMGDB£¬ÕâÊÇvimµÄ¼¯³Éµ÷ÊÔ»·¾³µÄÒ»¸öÖØÒª²å¼þ³ÌÐò¡£
µØÖ·£ºhttp://sourceforge.net/projects/clewn/files ......
1.ÒýÑÔ ±¾ÎĵÄд×÷Ä¿µÄ²¢²»ÔÚÓÚÌṩC/C++³ÌÐòÔ±ÇóÖ°ÃæÊÔÖ¸µ¼£¬¶øÖ¼ÔÚ´Ó¼¼ÊõÉÏ·ÖÎöÃæÊÔÌâµÄÄÚº¡£ÎÄÖеĴó¶àÊýÃæÊÔÌâÀ´×Ô¸÷´óÂÛ̳£¬²¿·ÖÊÔÌâ½â´ðÒ²²Î¿¼ÁËÍøÓѵÄÒâ¼û-¡£
Ðí¶àÃæÊÔÌâ¿´ËƼòµ¥£¬È´ÐèÒªÉîºñµÄ»ù±¾¹¦²ÅÄܸø³öÍêÃÀµÄ½â´ð¡£ÆóÒµÒªÇóÃæÊÔÕßдһ¸ö×î¼òµ¥µÄstrcpyº¯Êý¶¼¿É¿´³öÃæÊÔÕßÔÚ¼¼ÊõÉϾ¿¾¹´ïµ½Á ......
#
ÊÇÉú³É×Ö·û´®£º
#define a(x) #x
a(bc
) => "bc"
##
ÊÇÁ¬½Ó£º
#define a(x) abc##x
&n ......
int main()
{
int a[] = {1,2,3,4,5};
int i;
int * p = a;
for (p = a + 4, i = 0; i < 5; i++) {
printf("%d ",p[-i]);
}
return 0;
}
......
ÓÉÓÚ³ÌÐòÔËÐÐʱռÓõÄÄÚ´æ¹ý´ó£¬ËùÒÔÏë°ì·¨¸ø³ÌÐòÊÝÉí¡£
ÔÚµ÷ÊÔÖз¢ÏֽṹÌåÕ¼ÓõÄsize¾¹È»ºÍÔ¤ÏëµÄ²»Ò»Ñù£¬ÔÀ´……
¿´¿´ÏÂÃæ½²µÄ°É£¬¿Ï¶¨»á²»Í÷´Ë¿´Å¶£¡
1,±ÈÈç:
struct{
short a1;
short a2;
short a3;
}A;
struct{
......