Keil Logo

Return Values

C functions (which are declared as follows) may return a single value with a specified type.

<[>type<]> funcname (<[>args<]>)

where:

type is the type of the value returned from the function. If no type is specified, int is assumed.
funcname is the name of the function.
args is the argument list for the function.

Return values are always returned in registers depending on the return value type. The following table lists return types and the registers used for each.

Return Type Register(s) Description
bit R4.0  
signed char
unsigned char
RL4  
signed int
unsigned int
R4  
signed long
unsigned long
R4-R5 LSB in R4, MSB in R5.
float R4-R5 32-bit IEEE format, exponent and sign in R5.
double R4-R7 64-bit IEEE format, exponent and sign in R7.
near (2-byte) pointer R4  
far (4-byte) pointer
huge (4-byte) pointer
R4-R5 Offset in R4, selector in R5.
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.