Inline Functions - C Function

C examples for Function:Function Definition

Introduction

You can tell the compiler to inline a function by using the inline function modifier.

inline function is most suited for use with small functions that are called inside loops.

Larger functions should not be inlined since it may decrease performance.

Demo Code

#include <stdio.h>
inline int increment(int a) { return ++a; }

int main(void) {
  int i;// www  .ja  v a 2s  .  c  o m
  for(i = 0; i < 100;) {
    i = increment(i);
  }
}

Related Tutorials