[C]CÓïÑÔ»ù´¡¹®¹ÌרÌâ Á´±íÖ®£¨Á´±í´´½¨ºÍɾ³ý£©
Á´±íÖÐÓÐÁ½¸ö¹Ø¼üµÄ²Ù×÷£º´´½¨ºÍɾ³ý¡£½ñÌìÎҾͶÔÕâÁ½¸ö²Ù×÷½øÐнéÉÜ£¬
´ÓÕâÁ½¸ö²Ù×÷ÖÐѧϰµ½Á´±íµÄ»ù±¾Ó÷¨¡£
1. Create
Create() ÊÇÒ»¸öÁ´±í»ù´¡£¬Ö»Óн¨Á¢ºÃÁ´±í²ÅÄܶÔËü½øÐÐÏàÓ¦µÄ²éÕÒ£¬É¾³ý µÈ¡£
»ù±¾Ëã·¨£º
1.³õʼ»¯
head=NULL;
ls=new test£»
cin>>ls->num;
Í·½áµãÖ¸ÏòNULL£¬ ´´½¨Ò»¸ö½Úµã£¬ÊäÈënum¡£
le £ºÕâ¸öÖ¸ÕëÓÃÓڼǼ×îºóÒ»¸öÔÚÁ´±íÉϵĽڵ㣬·Ç³£useful.
2.½øÈëÑ»·£¬Ìõ¼þÊÇnum!=0.
1) ÅжÏhead==NULL,
Èç¹ûΪÕ棬±íÃ÷Á´±íΪ¿Õ£¬
Ôò½«½ÚµãÁ¬½Óµ½headÉÏ¡£
·ñÔò½«½ÚµãÁ¬µ½×îºóÒ»¸ö½ÚµãÉÏ¡£
2) ΪºóÃæµÄÑ»·×ö×¼±¸
leÇ°ÒÆ:le=ls;
ls ¿ª±Ùнڵ㣬¸³Öµ: ls=new test; cin>>ls->num.
3.ÊÕβ
ÔÚ֮ǰ¶à¿ª±Ù³öÒ»¸ö½Úµã£¬Òª½«Æäɾ³ý£¬ÁíÍâ¾ÍÊÇleÊÇÖ¸Ïò×îºóÒ»¸ö½ÚµãµÄ
£¬ËùÒÔ½«le->next=NULL.
£¨´ËËã·¨»¹ÓиĽøµÄµØ·½£¬ÄǾÍÊÇ¿ÉÒÔÏÈÅжÏnumÊÇ·ñΪ0 ÔÚ¾ö¶¨ÊÇ·ñ¿ª±Ù£©
struct test
{
int num;
test * next;
};
test * head;
test * create()
{
head=NULL;
test * ls,le;
ls=new test;
cin>>ls->num;
le=ls;
while(ls->num!=0)
{
if(head==NULL)
{
head=ls;
}
else{
le->next=ls;
}
le=ls;
ls=new test;
cin>>ls->num;
}
le->next=NULL;
delete ls;
return head;
}
2. Delete
Delete ÊÇÔÚ¸ø¶¨Ò»¸öÁ´±íµÄÍ·½áµãµÄÖ¸ÕëºÍҪɾ³ýµÄÒ»¸öÊý£¬½ø¶ø¶ÔÆäɾ³ý¡£
»ù±¾Ëã·¨ÈçÏ£º
ÓÉÓÚɾ³ýµÄʱºòÒª¿¼ÂÇÈýÖÖÇé¿ö£º
1. Èç¹ûheadΪ¿Õ£¬Ö±½Ó·µ»Ø
2.Èç¹ûɾ³ýµÄΪÊ׽ڵ㣬ÔòÒª½«´Î½ÚµãµÄµØÖ··µ»Ø¸øhead
3.ʣϵÄÇé¿ö¾ÍÊÇÖмäºÍĩβµÄ½Úµ
Ïà¹ØÎĵµ£º
UTF-8×î´óµÄÒ»¸öÌص㣬¾ÍÊÇËüÊÇÒ»Öֱ䳤µÄ±àÂ뷽ʽ¡£Ëü¿ÉÒÔʹÓÃ1~4¸ö×Ö½Ú±íʾһ¸ö·ûºÅ£¬¸ù¾Ý²»Í¬µÄ·ûºÅ¶ø±ä»¯×Ö½Ú³¤¶È¡£
UTF-8µÄ±àÂë¹æÔòºÜ¼òµ¥£¬Ö»ÓжþÌõ£º
1£©¶ÔÓÚµ¥×ֽڵķûºÅ£¬×ֽڵĵÚһλÉèΪ0£¬ºóÃæ7λΪÕâ¸ö·ûºÅµÄunicodeÂë¡£Òò´Ë¶ÔÓÚÓ¢Óï×Öĸ£¬UTF-8±àÂëºÍASCIIÂëÊÇ ......
º¯ÊýÃû: strtok
¹¦ ÄÜ: ²éÕÒÓÉÔÚµÚ¶þ¸ö´®ÖÐÖ¸¶¨µÄ·Ö½ç·û·Ö¸ô¿ªµÄµ¥´Ê
ÓÃ ·¨: char *strtok(char *str1, char *str2);
³ÌÐòÀý:
&nbs ......
GNU CµÄÒ»´óÌØÉ«£¨È´²»±»³õѧÕßËùÖª£©¾ÍÊÇ__attribute__»úÖÆ¡£__attribute__¿ÉÒÔÉèÖú¯ÊýÊôÐÔ£¨Function Attribute£©¡¢±äÁ¿ÊôÐÔ£¨Variable Attribute£©
ºÍÀàÐÍÊôÐÔ£¨Type Attribute£©¡£
__attribute__ÊéдÌØÕ÷ÊÇ£º__attribute__Ç°ºó¶¼ÓÐÁ½¸öÏ»®Ïߣ¬²¢ÇкóÃæ»á½ô¸úÒ»¶ÔÔÀ¨»¡£¬À¨»¡ÀïÃæÊÇÏàÓ¦µÄ__attribute__²ÎÊý¡£
__at ......
c º¯ÊýÖ¸Õë
ÒÔǰʲôº¯ÊýÖ¸Õë,Ö¸Õ뺯Êý½ö½öÊǸÅÄîÉϵÄÀí½â,×î½üд¸ö³ÌÐòÓÐÕâô¸öÐèÇó,ÆäʵҲ²»ÊÇÓÐÕâô¸öÐèÇó,¶øÊÇÕâÑùд¿ÉÒÔÊ¡È¥ºÜ¶àÊÂ....searchÁËÏÂ,ÕÒµ½Ò»ÆªºÃÎÄ
º¯ÊýÖ¸ÕëÊÇʲô£¿
ÏÈÀ´¿´º¯Êýµ÷ÓÃÊÇÔõô»ØÊ¡£Ò»¸öº¯ÊýÕ¼ÓÃÒ»¶ÎÁ¬ÐøÄÚ´æ¡£µ±µ÷ÓÃÒ»¸öº¯Êýʱ£¬Êµ¼ÊÉÏÊÇÌøתµ½º¯ÊýÈë¿ÚµØÖ·£¬Ö´ ......
1.int *p1 = *(int **)p2;
Õâ¸ö±í´ïʽ½«p2Ö¸ÏòµÄÖµµ±×öÖ¸ÕëÀàÐ͸³Öµ¸øp1
£¬½«ÆÕֵͨµ±×öÖ¸ÕëֵʹÓÃ
2.*£¨int **£©p1 = p2£»
Õâ¸ö±í´ïʽ½«p1Ö¸ÏòµÄÖµÐÞ¸ÄΪµÄp2±£´æµÄÖ¸Õë
µÄÖµ£¬½«Ö¸Õëµ±×öÆÕֵͨʹÓÃ
ÕâÊǽñÌì¿´us/OSµÄÄÚ´æ¹ÜÀíµÄʱºò¿´µ½µÄ£¬ÕæÊÇÌ«¾«±ÙÁË
°¦£¬¿´À´×Ô¼ºµÄ¼ûʶ»¹ÊÇÌ«ÉÙÁË£¬ÒÔºóµÃ¼Ó±¶Å ......