box-o-sand/lcthw-remnants/ex22_ec1.c
Dan Buch f2380eef05 Add 'lcthw-remnants/' from commit 'e172f73c8297b22a579c94558f0c171ca74a0e5c'
git-subtree-dir: lcthw-remnants
git-subtree-mainline: 4107485591
git-subtree-split: e172f73c82
2013-01-09 23:42:19 -05:00

29 lines
434 B
C

#include <stdio.h>
#include "dbg.h"
int pass_by_value(int n)
{
n = n + 2;
return n;
}
int pass_by_reference(int *n)
{
*n = *n + 8;
return *n;
}
int main(int argc, char *argv[])
{
int n = 2;
log_info("n = %d", n);
log_info("By value example: %d", pass_by_value(n));
log_info("n = %d", n);
log_info("By reference example: %d", pass_by_reference(&n));
log_info("n = %d", n);
return 0;
}