Here I'll document my journey through C language. In Documentation is the syntax, commands and other stuff that may need to be remembered. In Programs are some tests for some exercises or other things.
The first think you'd like to do is a hello world program, you can check mine in the helloworld.c
file, but the least you need to run a C program is a main()
function. Make, for example a file whose name ends in .c
, such as hello.c
#include <stdio.h> // Include information about standard library
main() // Define a function named main
{ // Statements are enclosed in braces
// main calls library function printf
printf("hello, world\n"); // to print this sequence of characters;
// \n represents the new line character
}
This example comes from The C Programming Language book
Whether any operating system you are using or your text editor, you need a compiler, and you can find instructions about it in Compiling, but if you have it already installed, just use the gcc
command
gcc hello.c
It will generate an a.out
file, to execute it use this command
./a.out
Or a.exe
on Windows
.\a.exe
helloworld.c
It's just a hello world.circle.c
Circle's area and circumference calculator.guessnumber.c
You need to guess the number I'm thinking.minesavoider.c
Avoid the mines!even.c
The very first time I use argumentsdonut.c
A cool 3D donut rendered with ASCII characters by Lex Fridman
- The C Programming Language book
- Bro Code's youtube playlist
- Microsoft's get started on linux
- DevDocs' pretty cool documentation