Show Menu
Cheatography

Basic C Cheat Sheet (DRAFT) by

Basics programming notion for C langage

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Function prototype

int main(argc, **argv){

         int age = 19;
         printf("I'm %d years old\n", age);
         return 0;

}
%d formatting correspond to the (only) parrameter after the comma age.
This function must return an int (specify in protot­ype).

Low level progra­mming

Fast and memory efficient
Powerfull
Direct contact with hardware
More control
Machine dependent
Unsafe
Requires a high level of knowledge
Difficult to developp and debug
 

Type formating

signed char
%c
unsigned char
%c
short signed int
%d
short unsigned int
%u
singed int
%d
unsigned int
%u
long signed int
%ld
long unsigned int
%lu
float
%f
double
%lf
long double
%Lf
 

Compiler - gcc

$ gcc -Wall -Wextra -Werror -O3 -o name_exe name_c_file.c
$ ls
name_exe name_c_file.c
$ ./name_exe
First command to compile (cpp, gcc, as, ld) and second to launch your executable file.

Best text editor / IDE for C

Vim
Sublime Text
Emacs
Visual Studio Code
CLion
CodeBlocks
XCode
Atom