blob: 0f5662554447d2287eb03787276b8337eb1344d6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset='utf-8'>
<title>C - Basic</title>
</head>
<body>
<a href="index.html">C Index</a>
<h1>C - Basic</h1>
<h2 ="sources">Multiple Sources</h2>
<p>To organize code in multiple files split above
example in main.c, hello.c and hello.h. Content of
main.c;<p>
<pre>
#include "hello.h"
int main() {
hello("world");
return 0;
}
</pre>
<p>Header file contains declaration of the function hello,
content of hello.h;</p>
<pre>
void hello(const char* name);
</pre>
<p>Implementation of hello function in hello.c;</p>
<pre>
#include <stdio.h>
#include "hello.h"
void hello(const char* name) {
printf("Hello, %s!\n", name);
}
</pre>
<p>Compile;</p>
<pre>
$ gcc -Wall main.c hello.c -o hello
</pre>
<a href="index.html">C Index</a>
<p>
This is part of the LeetIO System Documentation.
Copyright (C) 2021
LeetIO Team.
See the file <a href="../../fdl-1.3-standalone.html">Gnu Free Documentation License</a>
for copying conditions.</p>
</body>
</html>
|