Cר¼Ò±à³Ì¾«±àÖ®Ò»
Cר¼Ò±à³Ì ¾«±àÖ®Ò» µÚÒ»ÕÂ~µÚÈýÕÂ
CµÄ¸´ÔÓÖ®´¦ ÔÚÓÚËüµÄÖ¸Õë ,µ«ÊÇ±ÈÆäÖ¸Õë¸üΪ¸´ÔÓµÄÊÇËüµÄÉùÃ÷ !!!
ÄãÄÜ¿´¶®ËüÃǵÄÒâ˼ Âð?
apple=sizeof(int)*p ; apple=sizeof * p;
j= (char (*)[20])malloc(20);
int const * grape; Óë int * const grape; µÄÇø±ð
typedef void (*ptr_to_func)(int);
void (*signal(int sig,void (*func)(int )))(int );
¼¸¸öÑùÀý:
Ò»:char *a; const char *b; a=b;//³öÏÖ¾¯¸æ. why?
¶þ: const int two =2;
switch(i)
{
case 1:printf("case 1 ! \n");
case two :printf("case 2\n");
}
±àÒë³ö´í,˵Ã÷ÁË.....?
Èý:switch(){..}ÖÐ°Ñ default¸Ä³É defau1t (ÎÞÐÄÖ®¹ý,»òÆäËü±êÇ©Èçdefavlt,dafault..)¶¼±àÒëͨ¹ý . why?
ËÄ: apple=sizeof(int)*p ; apple=sizeof * p; //ÊÇʲôÒâ˼? ÁíÍâ, y=sizeof x; ÄܱàÒëͨ¹ýÂð?
Îå: j= (char (*)[20])malloc(20); //ÔõôÑù?
Áù: result=*x/*y ; //³ö´í?why ?
z=y+++x; ¼´Îª: z=y++ +x; µ«z=y+ + +x; &n
Ïà¹ØÎĵµ£º
//Á¬½ÓÍ·Îļþ
#include <io.h>
#include <dir.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//¿½±´ÎļþÄ£¿é
int copyfile (char *infile, char *outfile)
{
FILE *in,*out; //¶¨ÒåÎļþÖ¸Õë
in = fopen(infile,"r"); //´ ......
linuxÊÇÒ»¸ö¸´ÔÓµÄÈí¼þϵͳ£¬ÆäÄÚºËÔ´´úÂëÍùÍù»áÓõ½Ò»Ð©ÔÚÓ¦ÓóÌÐòÉè¼ÆÖв¿³£¼ûÓïÑԳɷֺͱà³Ì¼¼ÇÉ£¬ÕâЩ¶¼ÊÇ·ÖÎöÄÚºËÔ´´úÂëµÄ»ù±¾¹¦£¬Ï£Íû´ó¼ÒÄÜÖØµãÕÆÎÕ¡£
Ê×ÏÈ£¬gcc±àÒëÆ÷´ÓÓïÑÔÀïÎüÊÕÁË“inline”ºÍ“const”¡£inlineº¯ÊýµÄ´óÁ¿Ê¹Óã¬ÓÐÀûÓÚÌá¸ßÔËÐ ......
[C/C++ Digestion] – Rule of Three,
¸´ÖÆ¿ØÖÆ
×÷Õߣº
Jason Lee @
http://blog.csdn.net/jasonblog
ÈÕÆÚ£º
2010-04-13
[1]
¸´Öƹ¹Ô캯Êý
copy constructor
Rule of Three
ÊÇÖ¸ÀàÈç¹ûÐèÒªÎö¹¹º¯Êý£¬Ôòͨ³£Ò²ÐèÒª¸´Öƹ¹Ô캯ÊýºÍ¸³Öµ²Ù×÷·û¡£¶øÆäʵϰ¹ßµØÏÔʾ±àдÕâÈýÕß±¾¾ÍÊÇÒ»¸öÁ¼ºÃµÄϰ¹ß¡£Òò ......
C×Ö·û´®´¦Àíº¯ÊýµÄʵÏÖ£¨Linux£©
#include <stddef.h>
char * ___strtok = NULL;
char * strcpy(char * dest,const char *src)
{
char *tmp = dest;
while ((*dest++ = *src++) != '\0')
/* nothing */;
return tmp;
}
char * strncpy(char * dest,const char *src,size_t count)
{
char *tmp = d ......
. ±àÒëµ¥Ôª(Ä£¿é)£º
ÔÚIDE¿ª·¢¹¤¾ß´óÐÐÆäµÀµÄ½ñÌ죬¶ÔÓÚ±àÒëµÄһЩ¸ÅÄîºÜ¶àÈËÒѾ²»ÔÙÇå³þÁË£¬ºÜ¶à³ÌÐòÔ±×îŵľÍÊÇ´¦ÀíÁ¬½Ó´íÎó(LINK ERROR), ÒòΪËü²»Ïñ±àÒë´íÎóÄÇÑù¿ÉÒÔ¸ø³öÄã³ÌÐò´íÎóµÄ¾ßÌåλÖã¬Äã³£³£¶ÔÕâÖÖ´íÎó¸Ðµ½°ÃÄÕ£¬µ«ÊÇÈç¹ûÄã¾³£Ê¹ÓÃgcc£¬makefileµÈ¹¤¾ßÔÚlinux»òÕßǶÈëʽÏÂ×ö¿ª·¢¹¤×÷µÄ ......