以下のプログラムの実行の各時点において、寿命を持つ変数を示して下さい。
- (a)プログラムリスト
#include <stdio.h> int k, m, n; int test1(int n), test2(int n), test3(int n); int main(void) { int m; test1(m); test3(m); test2(m); } test1(int n) { static int m; test2(m); } test2(int k) { int m; m = 10; } test3(int k) { int m; m = 10; }
- (b)解答の一例
- プログラム(と各関数)の実行順と、寿命を持つ各変数の対応表は、以下の通りです。