in Compiler Design
685 views
4 votes
4 votes
State whether the following statements are True or False with reasons for your answer

A symbol declared as ‘external’ in an assembly language program is assigned an address outside the program by the assembler itself.
in Compiler Design
by
685 views

1 comment

https://en.wikipedia.org/wiki/External_variable

If the program is in several source files, and a variable is defined in file1 and used in file2 and file3, then extern declarations are needed in file2 and file3 to connect the occurrences of the variable. The usual practice is to collect extern declarations of variables and functions in a separate file, historically called a header, that is included by #include at the front of each source file. The suffix .h is conventional for header names.

4
4

1 Answer

8 votes
8 votes
Best answer
$\textsf{extern}$ symbol in an assembler $($or $C)$ compilation unit (a file and all its included ones) is used to refer to $\textsf{global}$ symbols (either variables or functions) in other parts of the program including any shared libraries.

Now, an assembler at the time of assembling has no information about the address of these extern symbols. It is the job of the linker to resolve them once assembling is over.

So, $\textsf{FALSE}.$
selected by
Answer:

Related questions