最近Word2013出现了一个奇怪的问题,撤销按钮一直是灰色。做编辑时闪一下,又变为灰色。按Ctrl-Z也不管用。网上查询,得知解决方法(但是未找到确切原因):
关闭Word2013主程序,然后Win+R调出运行窗口,执行Winword.exe /safe,然后关闭窗口,再正常打开文档,发现撤销功能又回来了。
参考:
对于特殊的static类型的函数,它的特殊之处在于,它并不是保存在代码段,而是保存在静态区,因此造成了它的特殊性,这里不再展开讨论。
|
#include <stdio.h>
int main() {
A();
return 0;
}
void A() {
printf("I'm function A.\n");
B();
}
void B() {
printf("I'm function B.\n");
}
编译器警告:
test.c:9:6: 警告:与‘A’类型冲突
test.c:4:2: 附注:‘A’的上一个隐式声明在此
test.c:14:6: 警告:与‘B’类型冲突
test.c:11:2: 附注:‘B’的上一个隐式声明在此
|
声明与定义的区别:声明仅仅是告诉编译器有这个东西,是一种描述,不会占用内存。定义则会根据声明的结构,产生实际的内存占用。换句话说,定义是对声明的一个实现。这就类似于面向对象中类与对象的关系。
|
#include <stdio.h>
void
A();
void
B();
int main() {
A();
return 0;
}
void A() {
printf("I'm function A.\n");
B();
}
void B() {
printf("I'm function B.\n");
}
|
void A();
void B();
|
#include <stdio.h>
#include
"test.h"
int main() {
A();
return 0;
}
void A() {
printf("I'm function A.\n");
B();
}
void B() {
printf("I'm function B.\n");
}
|
#include "test.h"
void C() {
B();
}
|
void C() {
return;
}
|
#include "test.h"
void A() {
...
}
|
#include "test.h"
void B() {
...
}
|
void C() {
return;
}
void A() {
...
}
void C() {
return;
}
void B() {
...
}
|
#include <stdio.h>
int main()
{
int a=3, b = 5;
printf(&a["Ya!Hello!
how is this? %s\n"], &b["junk/super"]);
printf(&a["WHAT%c%c%c
%c%c %c !\n"], 1["this"],
2["beauty"],0["tool"],0["is"],3["sensitive"],4["CCCCCC"]);
return 0;
}
|
Hello! how is this? super
That is C !
|
(void (*)(int)) fun(int a, int b) {
...
}
|
void (*fun(int a, int b))(int) {
...
}
|
int*
fun2(int c, int d) {}
|
void
(*fun(int a, int b))(int) {}
|
int*
|
void (*...)(int)
|
fun2(int c, int d)
|
fun(int a, int b)
|
int
* p;
|
void
(*(*fun)(int, int))(int);
|
int
|
void (*...)(int)
|
*p
|
(*fun)(int, int)
|
int
* p;
|
void
(*(*fun2_p2)(int, void(*)(int)))(int);
|
int
|
void (*...)(int)
|
*p
|
(*fun2_p2)(int, void(*)(int))
|
void (*fun2(int a, void(*b)(int)))(int) {
...
}
|
int*
fun(int a, int b)
|
void
(*fun2(int a, void(*b)(int)))(int)
|
int*
|
void (*...)(int)
|
fun(int a, int b)
|
fun2(int a, void(*b)(int))
|
int*
(*p[4])()
|
void
(*(*fun_p[4])(int, void(*)(int)))(int)
|
int*
|
void (*...)(int)
|
*p[4]
|
*fun_p[4]
|
()
|
(int, void(*)(int))
|
int* (*(*p)[10])()
|
void (*(*(*fun_arr_p)[10])(int,
void(*)(int)))(int)
|
int*
|
void (*...)(int)
|
(*...[10])()
|
(*...[10])(int, void(*)(int))
|
(*p)
|
(*fun_arr_p)
|
#include<stdio.h>
typedef void (*HANDLER)(int);
void fun(int a) {
printf("Hi,
I'm fun! a = %d\n", a);
return;
}
int* fun0(int* a) {
return
a;
}
//(void (*)(int)) (fun)(int a, int b) {
void (*fun1(int a, int b))(int) {
printf("fun1
invoked. a = %d, b = %d\n", a, b);
return
fun;
}
void (*fun2(int a, void(*b)(int)))(int) {
printf("fun2
invoked. a = %d, I will invoke your function and return the function\n",
a);
(*b)(a);
return
b;
}
int main() {
int
a[3] = {1, 2, 3};
int
(*b);
int
(*p)[3];
printf("p
= %p, sizeof(p) = %d, sizeof(a) = %d\n", p, sizeof(p), sizeof(a));
p
= a;
printf("p
= a\n");
printf("&p
= %p, p = %p, a = %p\n", &p, p, a);
printf("p[0]
= %p, *p[0] = %p, p[1] = %p, *p[1] = %d, sizeof(p[1]) = %d, (*p)[1] =
%d\n", p[0], *p[0], p[1], *p[1], sizeof(p[1]), (*p)[1]);
printf("**p
= %d, *p = %p\n", **p, *p);
p
= &a;
printf("p
= &a\n");
printf("&p
= %p, p = %p, a = %p\n", &p, p, a);
printf("p[0]
= %p, *p[0] = %p, p[1] = %p, *p[1] = %d, sizeof(p[1]) = %d, (*p)[1] =
%d\n", p[0], *p[0], p[1], *p[1], sizeof(p[1]), (*p)[1]);
printf("**p
= %d, *p = %p, *a = %d\n", **p, *p, *a);
int
i = a;
printf("i
= a, i = %d, sizeof(a) = %d\n", i, sizeof(a));
i
= &a;
printf("i
= &a, i = %d, sizeof(&a) = %d\n", i, sizeof(&a));
printf("sizeof(fun)
= %d, fun addr = %p\n", sizeof(fun), fun);
void
(*fun_p)(int);
fun_p
= &fun;
(*fun_p)(1);
int*
(*fun0_p)(int*);
fun0_p
= &fun0;
i
= 0;
printf("fun0:
I'm return int point. a = %d\n", *(*fun0_p)(&i));
void
(*(*fun1_p1)(int, int))(int);
fun1_p1
= &fun1;
fun_p
= (*fun1_p1)(2, 3);
(*fun_p)(4);
void
(*(*fun2_p2)(int, void(*)(int)))(int);
fun2_p2
= &fun2;
(*fun2_p2)(5,
fun)(6);
HANDLER
(*fun1_p3)(int, int);
fun1_p3
= &fun1;
fun_p
= (*fun1_p3)(7, 8);
HANDLER
(*fun2_p4)(int, HANDLER);
fun2_p4
= &fun2;
(*fun2_p4)(9,
fun)(10);
void
(*(*fun2_arr[4])(int, void(*)(int)))(int);
for
(i = 0; i < sizeof(fun2_arr) / sizeof(fun2_arr[0]); i++) {
fun2_arr[i]
= &fun2;
fun2_arr[i](i,
fun)(i);
}
void
(*(*(*fun2_arr_p)[4])(int, void(*)(int)))(int);
fun2_arr_p
= &fun2_arr;
for
(i = 0; i < sizeof(*(fun2_arr_p)) / sizeof((*fun2_arr_p)[0]); i++) {
(*fun2_arr_p)[i]
= &fun2;
(*fun2_arr_p)[i](i,
fun)(i);
}
void
(*fun_arr[10])(int);
void
(*(*fun_arr_p)[10])(int);
fun_arr_p
= &fun_arr;
int(*(*(*fun_arr_p1)[10])(int))();
//int
(*fun_p2)(int a, int (*b)(int));
//void
(*fun(int, int))(int);
return
0;
}
|