0
0
Cprogramming~10 mins

Linking multiple files in C - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to include the header file utils.h in main.c.

C
#include [1]

int main() {
    print_message();
    return 0;
}
Drag options to blanks, or click blank then click option'
A"utils.h"
B<utils.h>
C"utils.c"
D<stdio.h>
Attempts:
3 left
💡 Hint
Common Mistakes
Using angle brackets instead of double quotes for user headers.
Including the source file instead of the header file.
2fill in blank
medium

Complete the code to declare the function print_message in utils.h.

C
void [1]();
Drag options to blanks, or click blank then click option'
AprintMessage
Bprint
Cmessage_print
Dprint_message
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different function name than the one defined.
Misspelling the function name.
3fill in blank
hard

Fix the error in the function definition in utils.c by completing the function name.

C
void [1]() {
    printf("Hello from utils!\n");
}
Drag options to blanks, or click blank then click option'
Aprint_message
Bmessage_print
Cprint
DprintMessage
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different function name in the definition.
Incorrect capitalization in the function name.
4fill in blank
hard

Fill both blanks to complete the Makefile rule to compile main.o from main.c.

C
main.o: [1] utils.h
	[2] -c main.c
Drag options to blanks, or click blank then click option'
Amain.c
Bgcc
Cclang
Dmain.h
Attempts:
3 left
💡 Hint
Common Mistakes
Using the header file as the source dependency.
Using the wrong compiler command.
5fill in blank
hard

Fill all three blanks to complete the Makefile rule to link main.o and utils.o into the executable app.

C
app: main.o utils.o
	[1] [2] [3] -o app
Drag options to blanks, or click blank then click option'
Agcc
Bmain.o
Cutils.o
Dclang
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to include all object files.
Using the wrong compiler command for linking.