C uses call by value to pass arguments by default. - C Function

C examples for Function:Function Parameter

Introduction

Code within a function cannot alter the arguments used to call the function.

Demo Code

#include <stdio.h>

int sqr(int x);

int main(void)
{
   int t = 10;//from   w ww .  j a  va2 s  . c o m

   printf("%d %d", sqr(t), t);

   return 0;
}

int sqr(int x)
{
   x = x*x;
   return(x);
}

Related Tutorials