Consider three source code files main.c, f1.c, and f2.c, containing some C source codes. The function main is defined in the file main.c, function f1 is defined in the file f1.c and function f2 is defined in the file f2.c.
The function main calls the function f1, and function f1 in turn calls the function f2. Your object is to create an executable file named say project.

Qu.1. What are the steps to be followed, when finally you execute “project” starting from source code preparation?

Qu.2. Is it possible to compile the file main.c, without having files f1.c, f2.c? Mention an option of a compiler that you know which is used to accomplish this.

Qu.3. Will there be any difference in the final executable, if it is produced for a 32 bit system / 64 bit system? Name a command by which you can find out the type of the executable file.

Qu.4. Suppose now the file f1.c contains a function f1, which is completely defined in that file and file f2.c, which contains a function f2, which is also completely defined in that file. The file main.c can either call f1 or f2. How can you ensure that the executable file will only contain the code for that function and no redundant code?

Qu.5. Please see, what type of assembly code is created, corresponding to the function call statements in your system

You show us your answers and we'll tell you if they're right. Daniweb is not a homework service.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.