Skip to content

Amarok24/C_snippets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

c_snippets

My C snippet collection. Most of it is old-school code (C89/C90, C99), so it should be fairly well portable to most systems, even old computers.

Compilation of source code with GCC

If you run into troubles when compiling, you might want to tell the GNU C Compiler (GCC) what C standard to use for compilation; here is a very basic example:

gcc -std=c99 somefile.c -o outputexecutable

If the math library is used (if you see #include <math.h> somewhere on top of the C source), you have to explicitly tell GCC to link the math library (this has historical reasons which I don't understand). Simply put -lm (link math) at the end of the compile line:

gcc -std=c99 somefile.c -o outputexecutable -lm

To reduce file size of the executable use the -s flag (remove all symbol table information).

About

My snippets in C language, ISO C90/C99.

Topics

Resources

License

Stars

Watchers

Forks

Languages