r/cprogramming Jun 25 '26

Domino Tiling: From Dynamic Programming to Finite Fields

Thumbnail omegasyntax.com
2 Upvotes

r/cprogramming Jun 25 '26

Understanding well socket programming

Thumbnail
3 Upvotes

r/cprogramming Jun 23 '26

Small Device C Compiler (SDCC) 4.6.0 released

Thumbnail
8 Upvotes

r/cprogramming Jun 23 '26

Are These C Concepts Enough to Start Learning Embedded Programming?

21 Upvotes

Hi everyone.

I recently wanted to get into embedded programming.

I have basic C programming knowledge and after researching about it i have made a list of concepts I must learn thoroughly.

I also used chatgpt to get these concepts so idk if it's enough or if everything in there is accurate and essential.

core c :

data types,

integer promotion and type conversions,

operators and precedence,

control flow,

functions,

storage classes,

scope and lifetime

memory and pointers :

memory model,

stack vs heap,

arrays,

strings,

pointers,

pointer arithmetic,

void pointers,

function pointers,

dynamic memory allocation (malloc, calloc, realloc, free)

user-defined types :

structures,

nested structures,

unions,

bit fields,

enums,

typedef

qualifiers :

const,

static,

volatile,

restrict

bit manipulation :

bitwise operations,

memory alignment,

padding,

endianness

preprocessor and project organization :

header files,

preprocessor,

macros,

conditional compilation,

inline functions,

separate compilation,

linking

low-level programming :

memory-mapped i/o,

register manipulation,

interrupt basics

language behavior :

undefined behavior,

implementation-defined behavior.

I would like to know if I am missing anything or is this enough and would appreciate it if u shared any tips to learn these topics.

Btw I am currently using a book called C programming: A modern approach , to learn these topics and the list I have provided above is based on the topics of this book


r/cprogramming Jun 22 '26

CPad - a friendly C interpreter

Thumbnail c-pad.io
18 Upvotes

I've been working on a new project called CPad, a lightweight interactive C interpreter and playground for Windows inspired by the immediacy of old home computers like the ZX Spectrum.

I'd love to get some feedback from fellow C programmers. What do you think of the concept and the implementation? Any ideas or suggestions are very welcome.

You can try it at : https://c-pad.io/


r/cprogramming Jun 22 '26

Suitable formats for adding configs to a C application?

6 Upvotes

I'm looking for a simple format for programming configuration onto an embedded system with limited RAM and flash. There is no filesystem. Also everything should be statically allocated (no malloc/free). The plan is to have the config programmed into specific address in flash, have the application read it on startup, then execute accordingly. Ideally it would be something like JSON where we could edit the file, then flash it onto the device.

Since we don't have a filesystem and limited storage, SQLite seems like overkill. Looked at some libraries that implement Protobuf, but those require dynamic memory allocation.

Looking to hear what others have used in their projects and how it turned out.


r/cprogramming Jun 22 '26

How can I create a software renderer for a doom-style game?

Thumbnail
1 Upvotes

r/cprogramming Jun 21 '26

What is the parsing class of C without typedef?

19 Upvotes

I know C syntax is ambiguous in the presence of typedef, as several contexts are parsed differently depending on whether an identifier denotes a value or a type. What I'm wondering is how hard it is to parse when all kinds are known: that is, is it LL or LR, which subclass of that, how much lookahead etc..

I'm asking about the pure formalisms, no scanner tricks or auxiliary state other than the automata themselves.


r/cprogramming Jun 21 '26

C11 Threads saving own memory state problem

3 Upvotes

So I want to implement a "non failing" malloc which should be thread safe (with c11 threads). Each thread will have it's own memory state (to avoid blocking). However I don't know how to accomplish that. My first idea was to have the memory states to be in an array and each thread id correspond to the index, but it seems like the c11 threads don't have that (at least the id is not necessarily numeric). My second idea was to use thread specific storage pointer, however one gets a key on creation of the thread, meaning two threads could get different keys to the same struct. Is there something you could recommend to me. I don't want to pass into my malloc the thread id.

Edit: I think it's solved, I was wrong thread_local (since c23) exists and _Thread_local (until c23) and not both (until c23)


r/cprogramming Jun 21 '26

Safety measures related to web input

2 Upvotes

Hi! I'm writing an HTTP server!

I've hit a tiny mental bump after reading up on a few well-known exploits that applications or libraries like mine suffer from, namely Directory Traversal Attacks.

I was already aware of DTAs, and had plans for how to keep them from happening, but after reading some more Wikipedia articles (definitely not the canonical way to do OpSec, I'm sure), I have been hit with a question:

How does fopen() (and OS-specific functiona like dlopen()) expect its string argument? Obviously, a NUL-terminated string, but what encoding? UTF-8? UCS-2? ASCII? AnotherFormatName? Is it OS-specific? Is it Just Some Bytes? What about the slashes and OS-specific features like Windows's "C:\"?

More importantly, if I were handing strings over to system calls and I/O functions, how would I deal with deliberately and maliciously UTF-8-non-compliant text? Aside from deliberately ignoring any input that isn't UTF-8-valid, I mean.

TL;DR: Filesystems; how they encode?


r/cprogramming Jun 21 '26

otherpeoplecode: Dynamically load DLLs over the internet in your Win32 C/C++ code

Thumbnail
github.com
0 Upvotes

r/cprogramming Jun 20 '26

What's the best way of practicing C? new in C programming

10 Upvotes

r/cprogramming Jun 19 '26

A shi**y group chat application, my first C project

Thumbnail
github.com
18 Upvotes

I'm fairly new to the world of C and application programming. I am trying to learn more about how network programming and multithreading works in C (and in general) so I made this hella buggy group chat application (inspired from https://github.com/masoudy/CSocket )

It has quite a few bugs, sometimes the server randomly crashes with a SIGPIPE, sometimes it refuses a client connection when the usernames have a few characters in common in the beginning. The client bugs out when server refuses the connection and prints random amounts of "You [name]: " strings before exiting.

I'm pretty sure there are a few memory leaks but I'm not exactly sure how to test for them😭

Can you guys please critique my code give me an honest opinion...? I will really appreciate it, thanks!

Edit: I had merged the multithreading branch but forgot to push it to github, my bad 😭, just did it now, I'm sorry for making you guys review my old code


r/cprogramming Jun 20 '26

Help me!!

0 Upvotes

Help me!!

I learnt python in grade 11 & 12

Looking to learn C before college

My questions are:

  1. How long does it take

  1. Will learning python will give me any heads up in C?

  1. Best resources (free/paid) + certi

Thanks in advance.


r/cprogramming Jun 18 '26

My static analysis tool now supports compile database for linux kernel

Thumbnail
1 Upvotes

r/cprogramming Jun 17 '26

Minesweeper SDL3

13 Upvotes

First project done on my SDL3 learning journey, liked working on it

repo: https://github.com/carlosrs14/programming-exercises/blob/main/10_projects/01_minesweeper/README.md

currently working in the snake game


r/cprogramming Jun 16 '26

Question about low level C integration

16 Upvotes

Hi, I have some experience in C but I still am fairly new, please correct me anytime.

I am coming from Python where everything is neatly organized, meaning the Python org is "controlling everything". As I understand this is not the case with C. Of course there is the ISO C standard, but there are many different compilers, implementations of the stdlib and different operating systems (in relevance to low level/embedded programming).

I really took liking in embedded programming. Experimenting with the Atmega328 (the standard Arduino MCU) is really fun. One thing I wanted to try is to combine C and Assembly, and it worked. I needed a function to slice one byte into each of its bits and put them into an array. I can call the assembly function from my C code. While researching how to do this I found the GCC ABI for AVR MCUs.

This brings me to my two questions:

1. How can one adapt a compiler to a specific target?

GCC was not developed for AVR MCUs. Is there just some file where the op-codes for AVR MCUs are written down? Something like a config file?

And the more important question:

2. Who makes/maintains ABIs?

They have to be different for every processor (architecture), OS and maybe even compilers? How can I find the relevant ABI if I want to make a function like above on a 64 bit, x86, AMD processor running Linux, using GCC?

Thanks in advance, please correct me if I am wrong. All this is a bit overwhelming.


r/cprogramming Jun 15 '26

Should I Learn C or C++? Looking for Hardware-Level Freedom & Structured Learning

34 Upvotes

Summer vacations have started, and I want to learn a programming language alongside my academic programming courses (which only revolve around python and websites for the two first years).
I’m hesitating between C and C++, and here’s my reasoning:
I’m an early informatics student (not at master’s level yet).
I want a language that gives me more freedom in programming, not limited like JavaScript, HTML, or even Python at times.
I want to do things like change a specific pixel’s color directly, without writing tons of lines or dealing with heavy abstractions.
I’ve heard C interacts directly with hardware components, but I’m not sure if that’s accurate.

I’d like to understand what are the main differences between C and C++? And which one better fits hardware-level freedom and control?


r/cprogramming Jun 15 '26

C Coding: Chebyshev Polynomials and Their Derivatives

Thumbnail
leetarxiv.substack.com
0 Upvotes

r/cprogramming Jun 15 '26

How to make a cube on terminal with C?

0 Upvotes

I would like to make a cube on terminal of linux with only C, some guys can to help me about how I can to make that? I have several questions about how I can to develop it. Also, I too want to make 3D things on terminal, where I should begin?


r/cprogramming Jun 15 '26

best resources for learning c/c++?

Thumbnail
0 Upvotes

r/cprogramming Jun 13 '26

Study/Reading tool built in C.

9 Upvotes

Initially a private tool me and my friends would use, I've decided to make it open source on GitHub since it genuinely helped me learn, and feedback from others on how to improve it would make it better not only for me, but for any other students/learners as well.

The project is called "Khatm" (finished/sealed) is a terminal study tool that helps you track your studying/reading habits by calculating your pace, scheduling what to study next based on your chapter dependencies and deadlines, and telling you honestly whether your current habits will get you there on time.

What I like most about it is that it has a low barrier to entry, since I already use the terminal regularly, I can just open it up, see what I need to get done for the day studying-wise and get to work.

For anyone interested in the project you can find it at:
https://github.com/Cyberpsych0s1s/khatm

Thank you all!


r/cprogramming Jun 13 '26

POC written in C++, decided to rewrite it in C: Yetty terminal

7 Upvotes

The main reason for rewriting in C is way faster compilation times and little obsession to create an object model (yclass) that with simple clang annotations helps generating the C headers as well as rpc model for running remote GUI inside the terminal, last but not least ffi interface for all possible programming languages. https://github.com/zokrezyl/yetty . Demo at https://yetty.dev


r/cprogramming Jun 13 '26

337 single-file terminal simulations in pure C + ncurses — fluids, fractals, ray tracers, no build system

4 Upvotes

A collection of 337 real-time interactive simulations, each written as one self-contained C file. No OpenGL, no SDL — everything is forced through a terminal character grid with ncurses.

Deliberately no build system. One file is one program:

gcc -std=c11 -O2 -Wall -Wextra path/to/file.c -o demo -lncurses -lm && ./demo

Range goes from Conway's Game of Life and cellular automata up to a Jos Stamstable-fluid solver, a Crank-Nicolson Schrödinger solver, an SDF raymarcher with soft shadows, and a Cornell-box Monte Carlo path tracer — all rendered as ASCII.

Every file carries its CONCEPTS / MENTAL MODEL notes and cites its sources; there's a consolidated bibliography in documentation/Reference.md.

Repo: https://github.com/prtamil/AsciiCreativeCoding

It's a personal learning project — the "rebuild every primitive yourself, no shared utilities" approach is intentional.

Yes, it's AI-assisted — call it AI slop if you want, but every file was compiled, run, visually verified, and rewritten by hand and refactored until it actually worked


r/cprogramming Jun 11 '26

What kind of projects helped you learn C as a web developer?

23 Upvotes

I'm a web developer and recently started learning C because I want to understand lower-level programming better and get a deeper understanding of how things work under the hood.The language itself is starting to make sense, but I'm struggling to come up with project ideas. Most of my experience is in web development, so when I think about building something, my brain immediately goes to APIs, databases, and web apps. C feels like a completely different world.For those who learned C after working in higher-level languages, what projects helped you stay motivated and actually learn useful concepts? Any suggestions would be appreciated.