From 2830b5fb96cce787ca8c7562a968effc3e57bdb1 Mon Sep 17 00:00:00 2001 From: Silvino Date: Wed, 26 Jun 2019 16:58:13 +0100 Subject: dev index re-organization --- dev/c/basic.html | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 dev/c/basic.html (limited to 'dev/c/basic.html') diff --git a/dev/c/basic.html b/dev/c/basic.html new file mode 100644 index 0000000..104e59a --- /dev/null +++ b/dev/c/basic.html @@ -0,0 +1,59 @@ + + + + + C - Basic + + + C & GDB Index + +

C - Basic

+ +

Multiple Sources

+ +

To organize code in multiple files split above + example in main.c, hello.c and hello.h. Content of + main.c;

+ +

+	#include "hello.h"
+
+	int main() {
+	    hello("world");
+	    return 0;
+	}
+	
+ +

Header file contains declaration of the function hello, + content of hello.h;

+ +
+	void hello(const char* name);
+	
+ +

Implementation of hello function in hello.c;

+ +
+	#include <stdio.h>
+	#include "hello.h"
+
+	void hello(const char* name) {
+	    printf("Hello, %s!\n", name);
+	}
+	
+ +

Compile;

+ +
+	$ gcc -Wall main.c hello.c -o hello
+	
+ + C & GDB Index +

+ This is part of the Hive System Documentation. + Copyright (C) 2019 + Hive Team. + See the file Gnu Free Documentation License + for copying conditions.

+ + -- cgit 1.4.1-2-gfad0