2,375 views
State whether the following statements are True or False with reasons for your answer

A subroutine cannot always be used to replace a macro in an assembly language program.

### 1 comment

can someone explain in detail ????

$\textsf{TRUE}.$

A macro is evaluated at compile time whereas a function call happens at runtime. So, we can write a macro to rename any symbol which is not possible to be replaced by a simple subroutine call. For example consider the following $C$ code.

#define type int
type foo (type arg1)
{
...
}
#undef type

In the above code a macro is used to define a type which is used as the return and argument types for the function $\textsf{foo}.$ This is not possible to be implemented as a simple subroutine call (but can be done using $\textsf{typedef}$ is the language supports it).

by

### 1 comment

Nice eg.
This is true. We can not replace macro entirely using a subroutine. Ex: Macro constant used for renaming.

@Ayush

by tp what do u mean?

I cannot understand
#include<stdio.h>

#define ch char

int main()

{

ch a,b;

return 0;

}

There is No function which can do this work instead of macro

ASSEMBLY ==> SUB-Routine

High-Level ===> Function
so means we must require coroutine here

1 vote
1
1,317 views