C
1/* test.c */
2
3#include <stdio.h>
4
5void say(){
6 extern void printLine();
7
8 printLine();
9 printf("I love imooc\n");
10 printf("good good study!\n");
11 printf("day day up!\n");
12 printLine();
13}
C
1/* main.c */
2
3#include <stdio.h>
4
5void printLine()
6{
7 printf("**************\n");
8}
9
10int main()
11{
12 extern void say();
13
14 say();
15 return 0;
16}
[OTHERWISE:]
C
1/* test.h */
2#ifndef TEST_H_
3#define TEST_H_
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9 void say();
10 void printLine();
11
12#ifdef __cplusplus
13}
14#endif
15
16#endif
C
1/* test.c */
2
3#include <stdio.h>
4#include "test.h"
5
6void say(){
7 printLine();
8 printf("I love imooc\n");
9 printf("good good study!\n");
10 printf("day day up!\n");
11 printLine();
12}
C
1/* main.c */
2
3#include <stdio.h>
4#include "test.h"
5
6void printLine()
7{
8 printf("**************\n");
9}
10
11int main()
12{
13 say();
14 return 0;
15}