Practice ยท 4 of 4
Simulate the Linker
Implement a tiny model of symbol resolution:
``c
int resolve(int *symbols, size_t n, const char *want);
`
symbols encodes definitions across object files: each element is
1 (definition), 0 (declaration only), or -1 (duplicate definition).
resolve returns: 0 if there is exactly one definition and at least one
declaration-or-definition overall, -1 if there are zero definitions, and
1` if there are two or more definitions (multiple definition error).
NULL or empty input returns -1 (nothing defined).
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Read the Build