Subroutine

From SEGGER Wiki
Revision as of 09:58, 23 June 2019 by Rolf (talk | contribs) (Created page with "A subroutine is a piece of program code that is designed to be called by a program. It is not a stand-alone application, so it is not usable in itself. I an real world applica...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

A subroutine is a piece of program code that is designed to be called by a program. It is not a stand-alone application, so it is not usable in itself. I an real world application, the bulk of the program consists of subroutines. A subroutine can take parameters and return a value.

Let's look at a simple example of a subroutine:

int Max(int a, int b)
  if (a > b) {
    return a;
  }
  return b;
}


Inlining

What is the difference between a function and a subroutine?