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

¡¾linux¡¿c++ ÄÚ´æ¹ÜÀí£¨¶þ£©

3. Ö¸ÕëÓëÊý×éµÄ±È½Ï
²»Í¬µã£º
      Êý×飺ҪôÔÚ¾ªÌì´æ´¢ÇøÓò±»´´½¨£¨ÈçÈ«¾ÖÊý×飩£¬ÒªÃ´ÔÚÕ»Éϱ»´´½¨¡£Êý×éÃû¶ÔÓ¦×Å£¨¶ø²»ÊÇÖ¸Ïò£©Ò»¿éÄڴ棬ÆäµØÖ·ÓëÈÝÁ¿ÔÚÉúÃüÖÜÆÚÄÚ±£³Ö²»±ä£¬Ö»ÓÐÊý×éµÄÄÚÈÝ¿ÉÒԸı䡣
Ö¸Õ룺¿ÉÒÔËæʱָÏòÈÎÒâÀàÐ͵ÄÄÚ´æ¿é£¬ËüµÄÌØÕ÷ÊÇ“¿É±ä”£¬ËùÒÔÎÒÃdz£ÓÃÖ¸ÕëÀ´²Ù×÷¶¯Ì¬ÄÚ´æ¡£
 
Á½ÕßÌØÕ÷±È½ÏµÄÀý×Ó£º
(1) ÐÞ¸ÄÄÚÈÝ£º
char a[] = “hello”;
a[0] = ‘x’ ; // ok
char *p = “hello”; //×¢ÒâpÖ¸Ïò³£Á¿×Ö·û´®
p[0] = ‘x’; //´íÎó¡£±àÒëÆ÷²»ÄÜ·¢ÏָôíÎó
Ö¸ÕëpÖ¸Ïò³£Á¿×Ö·û´®”hello”(λÓÚ¾²Ì¬´æ´¢Çø£¬ÄÚÈÝΪhello)£¬³£Á¿×Ö·û´®µÄÄÚÈÝÊDz»¿ÉÒÔ±»¸Ä±äµÄ¡£ÆóͼÐ޸ij£Á¿×Ö·û´®µÄÄÚÈݶøµ¼ÖÂÔËÐдíÎó¡£
(2) ÄÚÈݸ´ÖÆÓë±È½Ï
²»ÄܶÔÊý×éÃû½øÐÐÖ±½Ó¸´ÖÆÓë±È½Ï£¬Êý×é¼ä¸´ÖÆÓ¦¸ÃʹÓñê×¼º¯Êýstrcpy½øÐи´ÖÆ¡£Í¬Àí£¬±È½ÏbºÍaµÄÄÚÈÝÊÇ·ñÏàͬ£¬²»ÄÜʹÓÃif( b == a )À´Åжϣ¬Ó¦¸ÃʹÓñê×¼¿âº¯Êýstrcmp½øÐбȽϡ£
Óï¾äp = a²¢²»Äܽ«Êý×éaµÄÄÚÈݸ´ÖƸøÖ¸Õëp£¬¶øÊÇ°ÑaµÄµØÖ·¸³¸øÁËp£¬ÒªÏ븴ÖÆaµÄÄÚÈÝ£¬¿ÉÒÔÏÈÓÿ⺯ÊýmallocΪpÉêÇëÒ»¿éÈÝÁ¿Îªstrlen(a) + 1 ¸ö×Ö·ûµÄÄڴ棬ÔÙÓÃstrcpy½øÐÐ×Ö·û´®¸´ÖÆ¡£Í¬Àí£¬if( p == a) ±È½ÏµÄ²»ÊÇÄÚÈݶøÊǵØÖ·£¬Ó¦¸ÃÓÿ⺯Êýstrcmp±È½Ï¡£
// Êý×é
      char a[] = “hello”;
      char b[10];
      strcpy( b, a); //²»ÄÜÓÃif( b == a)
      …….
// Ö¸Õë
      int len = strlen(a);
      char *p = (char *)malloc( sizeof(char) * ( len + 1) );
      strcpy( p, a); // ²»ÄÜÓà p = a;
      if( strcmp( p, a ) == 0 ) // ²»ÄÜÓÃif( p == a )
…….
(3) ¼ÆËãÄÚ´æÈÝÁ¿
      ÓÃÔËËã·û sizeof ¿ÉÒÔ¼ÆËã³öÊý×éµÄÈÝÁ¿£¨×Ö½ÚÊý£©¡£
      ÏÂÀýÖУ¬sizeof (a)µÄÖµÊÇ12£¨×¢Òâ±ðÍü¼ÇÁË’’£©¡£Ö¸ÕëpÖ¸Ïòa£¬µ«ÊÇsizeof(p)µÄֵȴÊÇ4(32λ¼ÆËã»ú)£¬ÕâÊÇÒòΪsizeof(p)µÃµ½µÄÊÇÒ»¸öÖ¸Õë±äÁ¿µÄ×Ö½ÚÊý£¬Ï൱ÓÚsizeof(char *)£¬¶ø²»ÊÇpËùÖ¸µÄÄÚ´æÈÝÁ¿¡£
 &nbs


Ïà¹ØÎĵµ£º

LINUXÏÂviµÄÉèÖÃ

   ΪÁË·½±ã±àд³ÌÐò£¬ÕûÀíÁËviÉèÖõÄС·½·¨£¡
  
ÓÉÃüÁî“vi --version”ËùÏÔʾµÄÄÚÈÝÖªviµÄÈ«¾ÖÅäÖÃÎļþÔÚ/usr/share/vim/vim61/macros/vimrc£»
Óû§ÅäÖÃÎļþÔÚ$HOME/.vimrc
ËÑË÷ÍøÉÏÎÄÕ²¢ÊµÑéµÃÖª£º
    ÉèÖÃTAB¼üµÄÏÔʾ¿í¶È£ºset tabstop=4 & ......

linux»·¾³Ï£¬c++¿âÎļþÖеķûºÅµÄº¬Òå

c++¿âÎļþÖеķûºÅµÄº¬Ò壺
      ËùÓеķûºÅ¶¼ÊÇÒÔÏ»®Ïß¼ÓÉÏ´óд×ÖĸҲ¾ÍÊÇ"_Z"¿ªÍ·£¬¶ÔÓÚÔÚ ÀàÀï»òÕßÃüÃû¿Õ¼äÖеķûºÅ£¬ºóÃæ½ô¸ú"N"£¬È»ºóÊǸ÷¸öÃüÃû¿Õ¼äºÍÀàµÄÃû×Ö£¬Ã¿¸öÃû×ÖÇ°ÊÇÃû×Ö×Ö·û´®µÄ³¤¶È£¬ËæºóÊÇ´óд×Öĸ"E"£¬¶ÔÓÚÒ»¸öº¯Êý£¬ËûµÄ²ÎÊýÁÐ±í¶¼ÔÚEºóÃ棬 ......

Linux³£ÓÃÃüÁºÏ

1. man ¶ÔÄãÊìϤ»ò²»ÊìϤµÄÃüÁîÌṩ°ïÖú½âÊÍ
eg:man ls ¾Í¿ÉÒԲ鿴lsÏà¹ØµÄÓ÷¨
×¢£º°´q¼ü»òÕßctrl+cÍ˳ö£¬ÔÚlinuxÏ¿ÉÒÔʹÓÃctrl+cÖÕÖ¹µ±Ç°³ÌÐòÔËÐС£
2. ls ²é¿´Ä¿Â¼»òÕßÎļþµÄÊô*£¬ÁоٳöÈÎһĿ¼ÏÂÃæµÄÎļþ
eg: ls /usr/man
ls -l
a.d±íʾĿ¼(directory)£¬Èç¹ûÊÇÒ»¸ö”-”±íʾÊÇÎļþ£¬Èç¹ûÊÇlÔò±íʾÊÇ ......

LinuxͼÐλ¯Àú³Ì

LinuxͼÐλ¯Àú³Ì
    ×¢£º´Ë¶ÎÎÄÕÂ×ÛºÏÁËÖÚ¶à×ÊÁÏ£¬Ö÷ÒªÒýÓøöÈ˵çÄÔµÄÎÄÕÂ
   
    ̸ÆðOPIE£¬¾Í²»Äܲ»Ì¸Qt£¬È»¶øÒª¶ÔQtÓиöÀ´ÁúÈ¥ÂöµÄÈÏʶ£¬ÐèÒª´ÓLinux
ͼÐλ¯ËµÆð¡£ÈÃÎÒÃǻعËÏÂLinuxͼÐλ¯½çÃæ·¢Õ¹µÄÀúÊ·¡£
    Linuxʵ¼ÊÉÏÊÇÒÔUNIXΪģ°åµÄ£¬Ëü¼Ì ......

ѧϰLinux£¨Ò»£©

¹ýÄê»ØÀ´£¬¹«Ë¾ÓÐЩ¸Ä¶¯£¬Ô­ÏȵÄWinceƽ̨»»³ÉLinuxÁË£¬×Ô¼ºµÄѧϰ¼Æ»®Ò²ÒªËæÖ®¸Ä±ä£¬ËäȻ֮ǰû½Ó´¥¹ýLinuxϵͳÏà¹ØµÄ֪ʶ£¬µ«Òª×¥×¡»ú»áŬÁ¦Ñ§Ï°¡£
Ìýѧ³¤Ëµ£¬ÒªÑø³ÉЩBlogµÄÏ°¹ß£¬°Ñ×Ô¼ºµÄѧϰÐĵüÇÏÂÀ´£¬·½±ãÔÚѧҪÊDzéÔÄ£¬ÓеÀÀí£¬ÏÖÔÚ¿ªÊ¼×ܽáÐĵÃ֪ʶ¡£
ÔÚ¹«Ë¾¿ª·¢ÓõÄÊÇѧУµÄSEP 4020mini¿ª·¢°å£¬
³õÆÚÊÇÊìϤ» ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ