Function Return by Value or Address - C Function

C examples for Function:Function Return

Introduction

A variable may also be returned in by value or by address.

By default a function returns by value.

A copy of the value is returned to the caller.

Demo Code

#include <stdio.h>
int byVal(int i) { return i + 1; }

int main(void) {
  int a = 10;//from w w  w.ja v a2  s .com
  printf("%d", byVal(a)); /* "11" */
}

Related Tutorials