216k views
5 votes
What register is used for return values?

1) Stack pointer
2) Program counter
3) General-purpose registers
4) Accumulator

1 Answer

2 votes

Final answer:

The register typically used for return values is one of the general-purpose registers, such as the EAX in x86 architecture or the R0 in ARM architecture.

Step-by-step explanation:

The register used for return values in most computer architectures is commonly among the general-purpose registers. For instance, in x86 architecture, the EAX register is typically used to hold the return value of a function when a program is compiled using the C calling convention. However, different types of architectures and calling conventions might have different registers for this purpose. For example, in ARM architecture, the R0 register is used for this. It's important to note that the other registers serve different purposes: the stack pointer manages the call stack, the program counter holds the address of the next instruction to execute, and the accumulator is used to perform arithmetic and logic operations but is not specifically designated for return values.

User Martin Volek
by
7.4k points