ÉèΪÊ×Ò³ ¼ÓÈëÊÕ²Ø

TOP

cÓïÑÔ³£¼û±ÊÊÔÌâ×ܽá
2014-11-24 01:20:09 ¡¾´ó ÖРС¡¿ ä¯ÀÀ:4741´Î
Tags£ºÓïÑÔ ³£¼û ÊÔÌâ ×ܽá

¡¾1 ʹÓú꡿
1.1
#ifdef NDEBUG
#define TRACE(S) S
#else
#define TRACE(S) printf(¡°%s;\n¡±, #S); S
#endif
ÎÊ£ºÒÔÉÏTRACE()ºêµÄ×÷ÓÃÊÇʲô£¿
1.2 #errorµÄ×÷Óã¿
1.3 ¶¨ÒåÒ»¸öºê£¬Çó³ö¸ø¶¨Êý×éÖеÄÔªËصĸöÊý
#define NELEMENTS(array)
1.4 ¶¨ÒåÒ»¸öºê£¬Çó³ö¸ø¶¨½á¹¹Öиø¶¨³ÉÔ±µÄÆ«ÒÆÁ¿
#define OFFSET(structure, member)


¡¾2 Êý¾ÝÉùÃ÷ºÍ¶¨Òå¡¿
¸ø¶¨ÒÔÏÂÀàÐ͵ıäÁ¿aµÄ¶¨Òåʽ£º
a) An integer
b) A pointer to an integer
c) A pointer to a pointer to an integer
d) An array of 10 integers
e) An array of 10 pointers to integers
f) A pointer to an array of 10 integers
g) A pointer to a function that takes an integer as an argument and returns an integer
h) An array of ten pointers to functions that take an integer argument and return an integer
¡¾3 ¸´ÔÓÀàÐÍ£¨1£©¡¿
ÓÐÈçϱí´ïʽ£º


char (*(*x())[])();
ÇëÓÃÎÄ×ÖÃèÊöxÊÇʲô¡£


¡¾4 ¸´ÔÓÀàÐÍ£¨2£©¡¿
jmp_bufµÄ¶¨Ò壺
typedef struct _jmp_buf
{
REG_SET reg;
int extra[3];
} jmp_buf[1];
setjmpº¯ÊýµÄÔ­ÐÍ£º
extern int setjmp (jmp_buf __env);
ÎÊ£ºµ÷ÓÃsetjmpʱ´«µÝ__envµÄÄÚÈÝ£¬»¹ÊÇ´«µÝÖ¸Õ룿


¡¾5 Í·Îļþ¡¿
ÎÊ£ºÎªÊ²Ã´±ê׼ͷÎļþ¶¼ÓÐÀàËÆÒÔϵĽṹ£¿
#ifndef __INCvxWorksh
#define __INCvxWorksh
#ifdef __cplusplus
extern ¡°C¡± {
#endif
/*¡­*/
#ifdef __cplusplus
}
#endif
#endif /* __INCvxWorksh */
¡¾6 static¹Ø¼ü×Ö¡¿
Çë˵³östatic¹Ø¼ü×ÖµÄ3ÖÖÓô¦£º
£¨1£©ÓÃÓÚÈ«¾Ö±äÁ¿£»
£¨2£©ÓÃÓÚ¾Ö²¿±äÁ¿£»
£¨3£©ÓÃÓÚº¯Êý¡£
/* file.c */
static int a;
int b;
static int fn()
{
static int x;
int y;
}


¡¾7 const¹Ø¼ü×Ö¡¿
7.1 const¹Ø¼ü×ÖµÄÒâÒåÊÇʲô£¿
7.2 ½âÊÍÒÔϵıäÁ¿¶¨Ò壺
const int a1;
int const a2;
const int *a3;
int * const a4;
int const * const a5;
¡¾8 volatile¹Ø¼ü×Ö¡¿
8.1 volatileÒâÒ壿ÀýÈç
volatile int *p;
8.2 volatileÄܺÍconstÒ»ÆðʹÓÃÂð£¿ÀýÈç
volatile const int *p;
¡¾9 sizeof()¡¿
ÓÐÒÔ϶¨Ò壺
char *pmsg = ¡°A¡±;
char msg[] = ¡°A¡±;
char ch = ¡®A¡¯;
ÎÊ£º
sizeof(pmsg) =
sizeof(msg) =
sizeof(¡°A¡±) =
sizeof(ch) =
sizeof(¡®A¡¯) = £¨ÔÚC++ÖеÈÓÚ¶àÉÙ£¿£©
void f(char param[100])
{
// sizeof(param) =
}
¡¾10 ×Ö·û´®¡¿
ÓÐÒÔÏ´úÂë
char *pmsg = ¡°hello, world!¡±;
strcpy(pmsg, ¡°hi, there.¡±);
ÊÔÆÀÂ۸ôúÂë¡£


¡¾11 »ìºÏÔËËã¡¿
ÓÐÒÔÏ´úÂ룺
void foo()
{
unsigned int a = 6;
int b = -20;
(a+b > 6) puts(¡°> 6¡å) : puts(¡± < = 6¡å);
}
ÇëÎʵ÷ÓÃfoo()µÄÊä³ö£¿
¡¾12 ÄÚ´æ·ÃÎÊ¡¿
ÓÐÒÔÏ´úÂ룺
void fn()
{
int a[100];
int *p;
p = (int *)((unsigned int)a + 1);
printf(¡°p=0x%x\n¡±, *p);
}
ÊÔÆÀÂÛÒÔÉÏ´úÂë¡£
¡¾13 C¿âº¯Êý¡¿
Çë˵Ã÷ÒÔϺ¯ÊýµÄÒâÒ壺
void perror(const char *__s);
fdprintf(int, const char *, ¡­);
isspace(), isxdigit(), strerr(), sprintf()


¡¾´ó ÖРС¡¿¡¾´òÓ¡¡¿ ¡¾·±Ìå¡¿¡¾Í¶¸å¡¿¡¾Êղء¿ ¡¾ÍƼö¡¿¡¾¾Ù±¨¡¿¡¾ÆÀÂÛ¡¿ ¡¾¹Ø±Õ¡¿ ¡¾·µ»Ø¶¥²¿¡¿
ÉÏһƪ£ºCÓïÑÔ±ÊÊÔÌâ ÏÂһƪ£ºCÓïÑÔÃæÊÔÌâ´ó»ã×Ü

×îÐÂÎÄÕÂ

ÈÈÃÅÎÄÕÂ

Hot ÎÄÕÂ

Python

C ÓïÑÔ

C++»ù´¡

´óÊý¾Ý»ù´¡

linux±à³Ì»ù´¡

C/C++ÃæÊÔÌâÄ¿