【发布时间】:2015-03-09 10:36:14
【问题描述】:
假设有两个函数,即function1() 和function2()
int function1()
{
int F;
printf("enter any value");
scanf("%d",&F);
printf("Value is %d",F);
}
在function1() 变量中使用F,它是局部变量。如何在另一个函数function2() 中使用这个局部变量F 的值?
【问题讨论】:
-
程序中的任何地方,main() 之外
-
哪个是“母亲”功能和“女儿”功能 - function1 或 2?或者它们是兄弟函数,都是其他函数(function3)的女儿?
-
这段代码编译不正确。 (int 函数,没有返回)
-
作为参数发送或者使用全局变量。