Question: 1 . Reading ( C ) code with ( C ) Using the file input / output function provided by the

1. Reading \( C \) code with \( C \)
Using the file input/output function provided by the \( C \) language, you can read other \( C \) files in the \( C \) language code. You should read the test.c file and write a program that outputs the data type and name of the variables used in this file.
The test.c file can have global variables, and if there are global variables, it must be after \#include (i.e., a global variable is not declared between the function and the function). It can also have functions other than the main function, but for convenience, assume that the return value is void. Also, in the test.c. file, all functions other than the main function is defined above the main function. If test.c. has multiple functions, you must indicate which function the variables are in. For example, the test.c file can be given as follows:
\(\) test.c \(>\)
\#include
float global
void fun1(int a)f
int val:
\}
void fun2(int b)
int num;
\}
void main \(\{\)
int \( a, b,\underline{\underline{c}}\)
double d
\(\mathrm{a}=\mathrm{b}=\mathrm{c}=\underline{\underline{10}}\)
\( d=(\) double)\(\underline{\underline{a}}\)
printf("TEST")
return \(\underline{\underline{0}}\)
If test.c. is given as above, the output should be as below.
List of global variables
float type variable: global
List of variables included in fun 1 function
int-type variable: val
List of variables included in fun2 function
int-type variable: num
List of variables included in the main function
int-type variable: a b c
Double-type variable: d
Note: Only short, int, long, float, and double can exist in the data type of variables included in the test.c file (assuming there are no complex data types such as arrays, pointers, and structures).
Functional prototype: There is no separate function that needs to be implemented.
Restrictions: Ban the use of global variables.
Input: There is no separate input required by keyboard but read test.c file through file input (test.c. assumes it is in the same path as file C you submit).
Output: Outputs the data types and variable names included in test.c on each line.
1 . Reading \ ( C \ ) code with \ ( C \ ) Using

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!