Pass value into a function - C Function

C examples for Function:Function Parameter

Description

Pass value into a function

Demo Code

#include <stdio.h>

int main() {/*from w w  w.j  av  a2  s. c  o m*/
    void test(int);
    int n = 14;
    printf("%d\n", n);  // before calling test
    test(n);
    printf("%d\n", n);  // after return from test
}

void test(int a) {
    a = a + 6;
    printf("%d\n", a);  // within test
}

Related Tutorials