c
Strings in C
· β˜• 3 min read · ✍️ Ben Mason
Strings (c and c++) Strings are an array of characters * they are accessed using the address of the first character (item) in the array A String is an array of characters ending in a null character \0 char color[] = β€œblue”; // 5 Char array continaing 'b', 'l', 'u', 'e', '\0' char *colorPtr = β€œblue”; // pointer to memory location constinaing 'blue' don’t forget to size arrays to hold the null character if explicitly defining array length C++ String Read functions Collect unlimited Characters until space, tab or EOL cin >> word;

Pointers in C / C++
· β˜• 7 min read · ✍️ Ben Mason
Pointers (c and c++) The Basics and Pitfalls of Pointers in C | Hackaday single indirection Define a Pointer int *intPtr * – indirection operator or de-referencing operator &varable – Memory address to variable *intPtr – De-reference pointer (indirection), pull literal value located at the memory address of the pointer Pointer Example // Declare Variable int value1 = 5000; // Declare 3 pointers int *ptr1; int *ptr2; int *ptr3; // Assign address of variable to ptr1 ptr1 = &value1; // Assign address of ptr1 to ptr2 then ptr2 to ptr3 ptr2 = ptr1; ptr3 = ptr2; // Print literal value stored in value1 printf("value1: %d\n\r", value1); printf("ptr1: %d\n\r", *ptr1); printf("ptr2: %d\n\r", *ptr2); printf("ptr3: %d\n\r", *ptr3); /* Output value1: 5000 ptr1: 5000 ptr2: 5000 ptr3: 5000 */ // Set Literal value to the memory address in ptr3, setting the value of value1 to 4000 *ptr3 = 4000; // Print literal values printf("\n\rAssign 4000 to *ptr3\n\r"); printf("value1: %d\n\r", value1); printf("ptr1: %d\n\r", *ptr1); printf("ptr2: %d\n\r", *ptr2); printf("ptr3: %d\n\r", *ptr3); /* Output: Assign 4000 to *ptr3 value1: 4000 ptr1: 4000 ptr2: 4000 ptr3: 4000 */ Pointer Math Adding 1 to will increment the pointer address the size of the value type (ie int, char etc)

C Notes
· β˜• 4 min read · ✍️ Ben Mason
C Notes Operators in C and C++ – Wikipedia C Standard Library Reference Tutorial gcc compiler -g – option adds debug symbols An Introduction to GCC – How the compiler works How Compiler Works? The sequence of commands executed by a single invocation of GCC consists of the following stages: preprocessing (to expand macros) compilation (from source code to assembly language) assembly (from assembly language to machine code) linking (to create the final executable) Compilation is a multi-stage process involving several tools, including the GNU Compiler itself (through the GCC or g++ frontends), the GNU Assembler as, and the GNU Linker ld.

STM32 Development Notes
· β˜• 3 min read · ✍️ Ben Mason
STM32 Notes Embedded Wednesdays: Getting Started in Embedded Systems β€” Embedded STM32F4 Discovery – Libraries and tutorials for STM32F4 series MCUs by Tilen Majerle. Working with STM32F4xx series and Standard peripheral drivers (STD, SPL) or with STM32F0xx, STM32F4xx or STM32F7xx using Hardware abstraction layer libraries (HAL) from STMicroelectronics. My libraries are built on these 2 packages and are highly optimized compared to them. Code CubeMX may duplicate c files in C_SOURCES variable they must be removed of you will get multiple declaration errors in linking