Master the fundamental concepts of c programming deep dive through this focused micro-challenge.
memcpy, memset, and strlen sit at the bottom of almost every C program. glibc's production memcpy picks among a dozen SIMD variants at load time; your version starts with byte loops that expose the contracts underneath.
n bytes from src to dest; behavior is undefined if regions overlap (use memmove for that)value into n consecutive bytes; glibc uses this to zero pages before mmap returns them\0, return count excluding the terminatorcLoading…
Cast to char* because void* forbids pointer arithmetic in standard C. For strlen, walk with const char *p and increment until *p == '\0'.
For this exercise, you will implement my_memcpy, my_memset, and my_strlen without #include <string.h>. This task asks you to match libc semantics exactly, because getting overlap, null handling, or the terminator rule wrong is how real buffer bugs start.
Keep the relevant man page, ABI doc, or Rust reference chapter open while you work. When your output disagrees with the reference implementation on the same machine, the mismatch is usually an alignment rule, an off-by-one terminator, or a register slot you misread in GDB.
Implement three essential memory/string manipulation functions from scratch.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github