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

C Traps and Pitfalls ¶ÁÊéÕª¼Ç

Óõ¥ÒýºÅÒýÆðµÄÒ»¸ö×Ö·ûʵ¼ÊÉÏ´ú±íÒ»¸öÕûÊý£¬ÕûÊýÖµ¶ÔÓ¦ÓÚ¸Ä×Ö·ûÔÚ±àÒëÆ÷²ÉÓõÄ×Ö·û¼¯ÖеÄÐòÁÐÖµ¡£
ÓÃË«ÒýºÅÒýÆðµÄ×Ö·û´®£¬´ú±íµÄÊÇÒ»¸öÖ¸ÏòÎÞÃûÊý×éÆðʼ×Ö·ûµÄÖ¸Õ룬¸ÃÊý×鱻˫ÒýºÅÖ®¼äµÄ×Ö·ûÒÔ¼°Ò»¸ö¶îÍâµÄ¶þ½øÖÆֵΪÁãµÄ×Ö·û'\0'³õʼ»¯¡£
printf("Hello world\n");
Óë
char hello[] = {'H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '\n', 0};
printf (hello);
ÊǵÈЧµÄ


Ïà¹ØÎĵµ£º

cÊä³ö±ê×¼×ܽá

  CÊä³ö¸ñʽ×ܽá ÊÕ²Ø
CÊä³ö¸ñʽ×ܽá
 
1 Ò»°ã¸ñʽ
   printf(¸ñʽ¿ØÖÆ£¬Êä³ö±íÁУ©
   ÀýÈ磺printf("i=%d,ch=%c\n",i,ch);
   ˵Ã÷:
   (1)“¸ñʽ¿ØÖÆ”ÊÇÓÃ˫ƲºÅÀ¨ÆðÀ´µÄ×Ö·û´®£¬Ò²³Æ“ת»»¿ØÖÆ×Ö·û´®”£¬Ëü°üÀ¨Á½ÖÖÐÅÏ¢£º
 &nbs ......

C/C++ ÖеÄÒÆλ²Ù×÷Ê°ÒÅ

ÒýÑÔ
×î½ü±ÊÕßÒ»Ö±ÔÚ×öJPEGµÄ½âÂ빤×÷£¬·¢ÏÖÓÃÍêȫʹÓùþ·òÂüÊ÷½øÐнâÂë±È½Ï·Ñʱ£¬¶øʹÓñí½á¹¹´æ´¢±àÂëºÍÖµµÄ¶ÔÓ¦¹Øϵ±È½Ï¿ì½Ý£¬µ«ÊÇÒ²´æÔڱȽÏÄÑ´¦ÀíµÄµØ·½£¬±ÈÈç½âÂ빤×÷ͨ³£ÊÇÒÔλΪµ¥Î»µÄ²Ù×÷£¬ÕâÀï±ØÈ»»áÉæ¼°µ½ÒÆλ²Ù×÷£¬¶ø±ÊÕß֮ǰ¶ÔλµÄ²Ù×÷ºÜÉÙ£¬¾­ÑéºÜǷȱ£¬¾­¹ýÕâ´ÎÀúÁ·ÖÕÓÚ·¢ÏÖÁËÒ»¸ö×Ô¼ºÔø¾­ºöÊӵĶ«Î÷£¬ÄÇ¾Í ......

c/c++ string


1.±¾ÕÂ˼άµ¼Í¼£º



Example1:
char
*strcpy(char *target, const char *source) {
  char *t = target;

  // Copy the contents of source into target.
 
while(*source) *target++ = *source++;
  // Null-terminate the
target.
  *ta ......

linux C forkº¯Êý

´´½¨Ð½ø³Ì£ºforkº¯Êý
1.1.1. forkº¯Êý¸Éʲô£¿
     #include <sys/types.h>
     #include <unistd.h>
     pid_t fork(void);
      ‘fork()’º¯ÊýÓÃÓÚ´ÓÒÑ´æÔÚ½ø³ÌÖд´½¨Ò»¸öнø³Ì¡£Ð½ø³Ì³ÆΪ×Ó½ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ