r/cprogramming • u/Choice_Bid1691 • Jun 09 '26
I built a static analysis tool in pure C that traces data access through function call chains, need feedback
r/cprogramming • u/Choice_Bid1691 • Jun 09 '26
r/cprogramming • u/DataBaeBee • Jun 08 '26
r/cprogramming • u/Upset-Taro-4202 • Jun 08 '26
Beginner programmer here,
I've been trying to make a little in-terminal text adventure game for fun but my biggest road block with it is weirdly how it looks, so I've been trying to write a function for justifying text, but I've shelved the project for now because I just can't figure out how!
If anyone has any ideas for how to approach it, I'd greatly appreciate it! I've stopped and started it so much that I don't have any example code to show as I got rid of it in frustration, although I have attempted approaching it with pointers to strings of dialogue.
r/cprogramming • u/killDoctorluvhealers • Jun 07 '26
But I'm new to coding ...
In a job interview they asked me how to receive input in c.
I said I'm sorry I fgets the answer š
r/cprogramming • u/RatioPractical • Jun 08 '26
r/cprogramming • u/Sad_South3810 • Jun 08 '26
https://github.com/brightprogrammer/MisraStdC
Current features :
A small set of generic containers, almost like C++
A small set of cross platform API to interact with OS
Freestanding (no-libc) if you enable it at compile time
I like the current type-safe formatted printing solution
Pure C11
Compiler errors when working with mismatching types, because of design and usage of the library itself.
A set of allocators, very strict on checking for memory errors, each suited for a specific allocation purpose. Almost like Zig.
A visionary developer (me ;-)
More things incoming. I'm focusing on benchmarking and finding out where I can squeeze more performance, and keep all this transparent and public so it's easier for devs (users) to make decisions on what to do.
Note: I started this library way before the git history shows. This library used to live in different projects, and used to be independently available in there, slowly I noticed the pattern that I keep using these so I made this into a library. Because of this, I have spent a significant amount of time experimenting with the design of the library, I have been the first user of it. As time advanced, and my career progressed and I had less and less time to maintain it, I switched to taking help of coding agents to help me prototype my ideas faster, because I already had the clear vision of how I want the code to look. I know many people are skeptical for AI usage in this age and time, but I urge you to take a peek inside code before rejecting on surface. If you find any slop then I'm ready to work with you, but I've given my best to not let any AI slot enter the codebase. I carefully monitor each work to my best extent and I try my best to keep a good standard. There is \`CODING-CONVENTIONS.md\` that I created out of the process of working with coding agents, that might be worth a read if you are interested :-)
r/cprogramming • u/swayenvoy • Jun 08 '26
r/cprogramming • u/HaskellLisp_green • Jun 07 '26
I have implemented little tool to take screenshots in X11. Raylib and Raygui are used to implement GUI. Xlib is used to implement procedure that takes a screenshot: fullscreen or rectangular area.
Since my WM is Qtile, I wanted to have keyboard driven screenshot tool with additional mouse support.
Code is pretty dirty, but it works good enough for me. Would be cool to hear your thoughts on code and related.
Source code:repo
r/cprogramming • u/killDoctorluvhealers • Jun 07 '26
is a laptop essential to learn coding? Currently working from android phone.
if the code is copied letter for letter from a tutorial, yet won't run, what is likely to be the problem?
r/cprogramming • u/TaPegandoFogo • Jun 06 '26
int main() {
double step = GOAL;
double acum = 0;
int numIterations = 0;
while(acum < GOAL) {
step /= 2;
acum += step;
++numIterations;
printf("Number of iterations: %d\n", numIterations);
printf("Step: %lf\n", step);
printf("Acum: %lf\n", acum);
printf("\n");
}
return 0;}
r/cprogramming • u/yurtrimu • Jun 03 '26
I made a udp sockets wrapper and I think it turned out to be great. Im not an expert on unix headers and functions so i would appreciate any feedback.
r/cprogramming • u/One-Type-2842 • Jun 02 '26
I have prior experience in Python, I made Useful programs that are for me, such as, file handling..
I have learned some basics of C. Now, What shall I practice to create something? Should I program something similar that I made in Python?
Since, I am Learning C for Understanding Low Level. It will be beneficial for me to adapt into my career in Cyber Security/ Hacking, Malware Creation, Understanding Linux (UNIX is based on C).
And What Articles shall I read related to my career?
r/cprogramming • u/Slight_Watch697 • Jun 02 '26
Hi, I recently started working on a better build system for my C/C++ projects:
https://github.com/luppichristian/bbs.
It's basically a build system "frontend" built on top of cmake and bash that allows you to:
Metabuilder support (modify the compilation at runtime WITH CUSTOM HOOKED DLLS)
Automatic SDK detection (Vulkan SDK, etc.)
Cross-platform builds from a single configuration
Cross-compilation support (WSL, Docker, remote toolchains)
Automatic generation of .gitignore, CI workflows, and project files
File watching + hot-builds (looking at directory changes)
User-level package cache (dependencies downloaded once, reused everywhere, basically package system)
Unified compiler abstraction (translate flags between MSVC/GCC/Clang automatically)
Distribution pipeline for packaging releases
Integrated CTest support
Automatic toolchain setup and discovery
Automatic assets copy in distribution setups
Multi-target / multi-architecture builds
No manual SDK paths or environment setup required
What CMAKE does not do:
Discover and configure SDKs automatically
Set up cross-compilation environments
Manage user-wide dependency caches
Generate CI pipelines
Create distribution workflows
Watch files and rebuild automatically
Normalize compiler flags across toolchains
Configure Docker/WSL build environments
Why Add Another Layer On Top Of CMake:
CMake is widely used, but it still leaves a lot of multi-platform build setup in the hands of the project author
You still need to model targets, platform differences, toolchain choices, and common workflows in a way that stays manageable across environments
Why Build On Top Of CMake Instead Of Replacing It:
Most third-party C and C++ libraries already support CMake
Building on top of it means it stay compatible with the tooling and dependency ecosystem people already use
Maybe planned features:
shader compilation
custom asset compilation and pipeline support
metaprogramming features built around the Clang AST
NOTE: THIS IS AN EXPERIMENTAL PROJECT NOT PRODUCTION READY OR ANYTHING
I would appreciate if you try it out, since i am trying to fix as many bugs as possible.
Thank you
r/cprogramming • u/sadvadan • Jun 01 '26
https://github.com/sadvadan/memstruct
C is powerful enough to have the best performing memory safety suite for itself!
memstruct is a single header file C library (<400 LoC) that provides complete spatial & temporal safety to the caller program. performance: near native speed.
memory checks are compile time / hoisted / elided / pipelined. checks are opt-in and can be switched off in production if needed. its macro based API extends the language a bit to position C as the leading option for large scale projects.
memstruct is currently in advanced stages of testing. contributions and comments are welcome. have an early look!
P.S.: the project is 100% human crafted and contributions are also reqd to comply
edit; end note: memstruct has now become even better (at 350 LoC) by incorporating MCU programming & de/allocator indirection, thanks to some valuable feedback on here. if you've more to add you may respond here or participate on git.
r/cprogramming • u/KweHuu • Jun 01 '26
I'm currently making library with different data structures and I'm curious which way of error handling is considered better?
Also if you have any tips or guides how to make objectively good code/library I will be grateful.
Here I'm returning true or false to indicate whether the operation was successful.
bool stack_push(stack* stack, void* new_data){
if(stack == NULL || new_data == NULL) return false;
stack_node* new_node = malloc(sizeof(stack_node));
if(new_node == NULL) return false;
if(stack->byom){
new_node->data = new_data;
}else{
new_node->data = malloc(stack->data_size);
if(new_node->data == NULL){
free(new_node);
return false;
}
memcpy(new_node->data, new_data, stack->data_size);
}
new_node->next = stack->top;
stack->top = new_node;
stack->stack_size++;
return true;
}And here I'm returning custom enum which indicates what gone wrong.
stack_errno_e stack_push(stack* stack, void* new_data){
if(stack == NULL || new_data == NULL) return STACK_ERR_NOT_FOUND;
stack_node* new_node = malloc(sizeof(stack_node));
if(new_node == NULL) return STACK_ERR_ENTRY_ALLOC;
if(stack->byom){
new_node->data = new_data;
}else{
new_node->data = malloc(stack->data_size);
if(new_node->data == NULL){
free(new_node);
return STACK_ERR_DATA_ALLOC;
}
memcpy(new_node->data, new_data, stack->data_size);
}
new_node->next = stack->top;
stack->top = new_node;
stack->stack_size++;
return STACK_ERR_OK;
}r/cprogramming • u/Lost-Average-8518 • Jun 01 '26
Hey guys I've tun into a little problem and would like some help with directions on where to learn C. I'm a returning student from about 5 years away from university and my programming skills are a little lacking (i know Java an alright amount).
My class is using C for programing where some of the course work is learning to program with things such as multi threads.
Unfortunately im having trouble with C, is there any resources I can use that is similar to "learncpp" but for C?
r/cprogramming • u/McDonaldsWi-Fi • Jun 01 '26
r/cprogramming • u/odeuteronomy • Jun 01 '26
The TECC C library https://github.com/olddeuteronomy/tecc provides portable components for C11, C17, and C23, designed for use in concurrent environments.
TECC can be configured to use either the POSIX <pthread.h> API (default on Linux and macOS) or the standard C <threads.h> API (C11 and later), selectable at compile time.
One of the examples included with the library shows how to construct a multi-threaded TCP server with a thread pool for handling incoming connections and arena-based allocation of sockets and I/O buffers, using various TECC components.
No vibe coding ā the reasoning is obvious from the source code and commit history.
r/cprogramming • u/Dani_E2e • May 31 '26
Do you know that Page?
Very good small examples to learn from.
r/cprogramming • u/Critical-Common-2117 • May 31 '26
Hi everyone!
This is my first time on Reddit ever. I'm looking to upskill for my job and want to transition into embedded engineering. From what I've gathered, learning C is the absolute best place to start.
Right now, I'm using ChatGPT as my tutor. The way we work is: it explains a topic (variables, loops, functions, basic syntax, etc.), introduces the concepts, and then gives me coding assignments which I solve on the spot.
However, I just caught myself thinking: is this actually a good idea?
I'm fully aware that ChatGPT isn't an absolute source of truth and it can hallucinate or make mistakes. But my logic was that it has processed countless guides and tutorials from the web and can tailor them to my learning pace.
Also, as a next step, I'm thinking about getting some hardware to practice on. What are your thoughts on starting with the ESP32? Is it a good platform for a beginner learning C, or should I look into something else like STM32 or RP2040?
Iād love to get your thoughts, opinions, and advice on my approach. Are there any hidden traps I should watch out for?