Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

C Exercise 44

C Exercise 44

100 Classic C Language Examples 100 Classic C Language Examples

**Problem:** Learn how to call an external function.

**Analysis:** None.

Program source code:

Example

//  Created by www.runoob.com on 15/11/9.

// Copyright (c) 2015 Runoob Tutorial. All rights reserved.

//

#include

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 Language Examples 100 Classic C Language Examples