User:Lth/Learn C

From Stm32World Wiki
Jump to navigation Jump to search

Hello World - Desktop vs. MCU

When learning any programming language, the first "project" will typically be a small program which prints out "Hello World!".

Standard UNIX

On a standard UNIX system, that program, implemented in standard C, would typically look something like this:

1 #include <stdio.h>
2 
3 int main(void) {
4     printf("Hello World!\n");
5     return 0;
6 }

Most UNIX like systems have (or bloody should have) a C compiler, typically named cc, so above hello.c can be built into a binary executable thus:

$ cc hello.c -o hello

This will produce a binary hello, which can now be executed:

$ ./hello
Hello World!

Embedded

To be added

Variables & Fixed-Width Types

To be added

Control Flow & Decision Making

To be added

Loops & Iteration

To be added

Functions & Modular Code

To be added

Bitwise Operations Masterclass

To be added

Pointers Demystified

To be added

Arrays & Pointer Arithmetic

To be added

Structs & Memory Alignment

To be added

The volatile Keyword

To be added

Type Casting & Unions

To be added

Function Pointers & Callbacks

To be added

Enums & State Machines

To be added

Dynamic Memory vs. Static Allocation

To be added

Macros, Pragmas & Preprocessor

To be added

Miscellaneous Links

To be added