C Exercise Example 44

100 Classic C Examples

Title:Learn how to use and call external functions.

Program analysis:None.

Program source code:

Example

//  Created by www.example.com on 15/11/9.
// Copyright © 2015 Example Tutorial. All rights reserved.
//

#include <stdio.h>
int a,b,c;
void add()
{
    int a;
    a=3;
    c=a+b;
}
int main()
{
    a=b=4;
    add();
    printf("The value of c is %d\n",c);
    return 0;
}

The output of the above example is:

c 的值为 7

100 Classic C Examples

other extensions