###
*ptr++ 55555~~ i always forget ++ has a high priority than *.###
The number-sign or "stringizing" operator (#) converts macro parameters (after expansion) to string constants
#define paster( n ) printf( "token" #n " = %d", token##n )
int token9 = 9;
paster( 9 );
//那么在编译时,上面的这句话被扩展为:
printf( "token" "9" " = %d", token9 );
###. :
char s[0xff];
scanf( "%[0-9]", s); /* %[ is scarcely known. */
int n;
scanf("%d", &n); /* %d cannot interpret input number beginning with 0x(HEXADECIMAL) or 0(OCTAL) */
scanf("%i", &n); /* %i can read integer in base 16 if it begins with 0x or 0X, in base 8 if it begins with 0, and in base 10 otherwise. */
### :
introduced by C99
#define My_Macro(...)
For replacement, the variable arguments(including the separating commas) r collected into one single extra argument that can be referenced as __VA_ARGS__ within the macro's replacement list.
e.g. #define my_printf(fmt, ...) printf(fmt, __VA_ARGS__)
this is a wrapper of standard C library function printf().
###. :
introduced by C99
void user_fun ()
{
printf("%s", __func__ ); // this function will print the function name: usr_fun
}
### :
introduced by C99
#include <stdbool.h>
_Bool b = true; // or false
### :
introduced by C99: flexible array member. Structs: the last member may have an incomplete array type.
struct flexible_struct
{
int type;
int ary[];
}*fap1, *fap2; // NOTICE: sizeof(flexible_struct) = sizeof(int) = 4
fap1 = malloc(sizeof(struct flexible_struct) + 2*sizeof(int));
fap2 = malloc(sizeof(struct flexible_struct) + 3*sizeof(int));
...
*fap1 = *fap2; // Only copy the member type, but not the ary with variable length.
###
g, G The double argument is converted in style f or e (or F or E for G conversions). ---printf()