输入重定向例子: F:\C_Study\temp1\temp1.exe < F:\C_Study\temp1\myword.txt 把这个文档中的数据输入到程序。
输出重定向例子: F:\C_Study\temp1\temp1.exe > F:\C_Study\temp1\myword.txt 输出到这个文本文档。
输出重定向追加: F:\C_Study\temp1\temp1.exe << F:\C_Study\temp1\myword.txt
char (*f)()=getfirst;
int (*f2)(int a,double b)=max;
返回类型 (*指针名)(函数参数);
const int *p=a; //p指向的数据不可改变;
int * const p=a;//p不可指向别的内存;
const int * const p=a;//指向的数据不可改变,p不可指向别处内存。
用于硬件地址和其他并行程序共享的数据。
防止编译器对代码优化。直接读取原内存中数据。
const volatile 不能被程序改变,可以被程序以外的代理改变。
修饰指针。表示该指针是访问的唯一方式。//这样就可以让编译器优化代码。
memcpy(void * restrict s1,const void *restrict s2,size_t n);//从 s2 把 n 个字节复制到 s1。s1 和 s2 不可重复。
memmove(void * restrict s1,const void *restrict s2,size_t n);//从 s2 把 n 个字节复制到 s1;
fread(),fwrite(),feof()等等等等。本阶段用不到,这里不详举例了。
int *a[3][4] //12个指针。指向 int *类型。
int (*a)[3][4] //一个指针,指向 int[3][4]。
int (*a[3])[4] //三个指针,只想 int[4].
char (*f)() //函数指针。指向char。
char (*f[3])() //3个指向 char的函数指针。
##粘合。#粘合字符串。如 #define xname(n) x##n
__VA_ARGS__ 可变参数。如 #define PR(...) printf(__VA_ARGS__) 。 如#define PR(x,...) printf("mess"#x":"__VA_ARGS__)
#define limit 20 const int lim=50; const int data[limit];//不能用 lim static int data2[limit];//不能用 lim#ifdef xxx //和 #if define(xxx) 等价。判断是否被定义。 # ..... #else # ..... #endif
#ifnde xxx # ..... #endif
#if SYS == 1 # ... #endif #if SYS == 1 # ... #elif SYS == 2 # .... #elif SYS == 3 # ... #else # ... #endif
#if EOF == 1 #error not c99 #endif
#line 1000 "abc.c" //把当前行号重置为 1000 文件名置为 abc.c
