r/C_Programming Feb 23 '24

Latest working draft N3220

127 Upvotes

https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf

Update y'all's bookmarks if you're still referring to N3096!

C23 is done, and there are no more public drafts: it will only be available for purchase. However, although this is teeeeechnically therefore a draft of whatever the next Standard C2Y ends up being, this "draft" contains no changes from C23 except to remove the 2023 branding and add a bullet at the beginning about all the C2Y content that ... doesn't exist yet.

Since over 500 edits (some small, many large, some quite sweeping) were applied to C23 after the final draft N3096 was released, this is in practice as close as you will get to a free edition of C23.

So this one is the number for the community to remember, and the de-facto successor to old beloved N1570.

Happy coding! 💜


r/C_Programming 51m ago

Learning C weekly megapost for 2026-07-22

Upvotes

If you have questions about how to learn C:

  • which books are best?
  • which videos are best?
  • which classes are best?
  • which websites are best?
  • is there a "roadmap"?
  • what projects can I do?

then this is the thread for you. Add your question here. Do not make a stand-alone post, as it will be removed.

Remember that our sub has a very useful wiki that has a great list of resources for learning C programming.


r/C_Programming 7h ago

Question The easiest UI library? (cross-platform)

13 Upvotes

Hello, I need to write a small emulator for a project. I want it to show RAM, registers, etc., while it's running a program step by step. Printing them out via printf is lame and won't look good.

Which is the absolute easiest graphics library for this purpose? I was suggested Newt, but it can't work under Windows.

Preferably, the library should have tutorials, examples, or at least full documentation.


r/C_Programming 1d ago

Question Suggestion: Ban (or quarantine) "I Built This" posts?

130 Upvotes

Reading an interesting discussion over on r/rust from the past week. One of the moderators talks about the difficulty in moderating AI slop projects - https://www.reddit.com/r/rust/comments/1uwmef6/comment/oxkltxi/

But I think the top replies hit on a really good idea:

“I built a thing in Rust” just isn’t that interesting a topic—AI or otherwise—and IMO we’d be better off without posts like that at all. If you built a fast new BitTorrent client, that’s of interest to BitTorrent users, not the Rust community.

A library that lets me do a thing I couldn’t before? Very useful! A new approach to solving a problem that’s historically frustrating in Rust? Amazing. Questions on how to deal with some issue? Welcome aboard.

But I couldn’t care less about “{project} in {lang}” for all values.

and

r/cpp moderator here, we have a designated Show & Tell pinned post. We make exceptions only for established projects or blog posts talking about your project.

(And then remove AI slop)

One of the recurring issues in trying to moderate the flow of slop is having to constantly make a judgment call of just HOW "slop" it is and whether it crosses a line. Why not cut the problem off at the source: you simply cannot post an "I Built (Whatever)" here (with very few exceptions, etc). There's no need to make this a judgment call about AI/LLMs at all, neatly sidestepping the various arguments about the whole thing.

I personally do not feel like much would be missed!


r/C_Programming 5h ago

Learning how to send a 2 layer internet request

2 Upvotes

I was recently learning how to send msgs in different internet layers, and I write some examples from what google ai showed me.

Even tho I didn't fully understand what all the meaning of the full code. Running this program while wireshark is running, and seeing my own request is really cool.


r/C_Programming 12h ago

Question I am starting out on next project of simulating no-body problem. Need advice.

6 Upvotes

Hey there! In my last post, I was really excited after discovering ray tracing and the idea of implementing that thing in C. Now I am more curious and I want something that is physics/mathematics heavy and can be made in C. For this, I am thinking of moving towards simulating 2 body problem and then n body problem in C. I am not sure if this is the right path so I need advice for that.

Someone in my last post advised me to implement FXAA/MSAA in C from basic principles. I was excited but then, I asked chatgpt and it suggested that I first make something using graphics and then implement these algorithms for anti-aliasing. Any ideas are welcome.

Thank you! Have a great day for the help.


r/C_Programming 11h ago

printf and char[] in C

4 Upvotes

Hello. Coming from C# world the thing about how char[] and printf works always made me confused. I understand that `printf` formats the string with arguments you provided and prints it out in terminal.

So, for example, if I have char name[] = "Micheal"; and I want to greet that person, I can just do printf("Hello, %s", name);. But if I want to do the same thing only using char[], I have to do multiple commands that make fell quite confused. So my 2 questions are:

  1. How printf simplifies this process? (without allocating memory and creating char with pointers)
  2. Why you can't just use + operator for char[], like you can in any other languages?

I have a feeling that this might be asked many times, but I still can't seem to find the answer I was looking for

Update: I'll list what I got so far from reading your comments: - char[] is an array to which you can't just simply add another array - If I want printf() behavior inside char[], I can use sprintf() - There's strcat() that is getting used for merging 2 strings together - Some people write libraries for faking string behaviors, some think it goes against principles of C?


r/C_Programming 8h ago

A C subset that compiles faster than Tiny C Compiler - Cm1 (C minus 1 or C - 1) programming language

1 Upvotes

Hi everyone,

I'm working on a programming language that compiles a subset of C. It is called Cm1 (meaning C minus 1) and you can writing and running C codes directly on your browser at https://cp1-lang.org/cm1/editor.html in a fraction of a second.

Why is it faster to compile than Tiny C Compiler? It is because Tiny C Compiler is a true compiler creating native binaries whereas Cm1 is a bytecode interpreter allowing you to test, debug, edit code and recompile very quickly or even do hot reloading. Cm1 can be used as a scripting language for shell scripts and video games, but this just a small use case because in theory, you can run 90% of your ENTIRE video game or software C program through Cm1's bytecode interpreter and leave 10% to compiled C and reap the benefits of very fast compilation and hot reloading.

100% Cm1 codes are compilable by GCC and Clang but the reverse is not true since Cm1 is just a subset of C. Major features that are omitted are function pointers, structs/unions inside functions, nested structs/unions. This programming language is under heavy development and I want to know if this comes as interesting to some of you. I'll try to post again on this subreddit if I got to bind Raylib game library to Cm1, allowing people to write Raylib games directly on their browser (works offline).

I know that programs that are written in C compiles fast already and there's even an existing compiler that is very fast (Tiny C Compiler). However, I'm the developer of Cp1 programming language (cp1-lang.org), which is a language that "transpiles" to C, and I aim to upgrade Cp1 by targeting the Cm1 language then compile it to bytecode in one command instead of a separate step in Makefiles or build scripts. This will make Cp1 very fast to compile for debug builds.


r/C_Programming 1d ago

Question what should be avoided when designing an API?

53 Upvotes

What kind of thing you see beginners doing, when designing an API, should be avoided in your opinion (or just based on facts)?

I don't have too much experience creating interfaces for clients and every time i write a line of code, start thinking if it's a good idea or it's a bad decision that will break my legs in future. I get paralyzed for a considered period of time instead of just coding it.

edit: thanks a lot (really) for all answers.


r/C_Programming 2d ago

I built an orbital mechanics simulator in C with SDL2

Enable HLS to view with audio, or disable this notification

149 Upvotes

It is basically a gravity simulator where you can input any values of the orbital bodies and see the simulation evolve. You can simulate one body orbiting a bigger one or two orbiting each other. I focused on accuracy by integrating RK4 calculations. SDL2 is a great library and was very handy.

If you want to try it, I compiled it into an .exe for windows and an executable for linux.

Github link: https://github.com/bydrabokin/Gravity/

Youtube showcase: https://www.youtube.com/watch?v=hNupVTu2aC0


r/C_Programming 1d ago

I built a tiny in-memory store in C

Thumbnail
github.com
32 Upvotes

It's been about a month since I started learning C, so I decided to build a small in-memory key-value store to learn about hash tables and memory

It's still a learning project, so I'd appreciate any feedback or suggestions


r/C_Programming 1d ago

Project ELFDetective

0 Upvotes

This is a small linux program called ELFDetective I made a few months back. It handles both 32bit and 64bit ELF files and views their Header, Program Header and Section Headers.

GitHub: https://github.com/Adock90/ELFDetective

Download: https://adock90.github.io/Adock90Software/products/ELFDetective.html


r/C_Programming 2d ago

Question Systems devs: Is AI code generation actually saving you time, or just creating auditing hell?

45 Upvotes

Hey everyone,

With Linus Torvalds recently embracing and defending AI tools in Linux kernel dev, I’ve been trying to force myself to use LLMs more in my daily low-level workflow. On one hand, if the Linux kernel ecosystem is adopting it to find bugs and speed things up, it feels like something we should all be leveraging.

But on the other hand, on a practical, day-to-day level? It feels like a massive trap for actual systems engineering.

Every time I let an LLM spit out a driver, a custom memory allocator, or complex socket-handling logic, I end up spending the next hour reading 150 lines of statistically plausible C/Rust code just trying to figure out if it’s going to cause a catastrophic race condition or a silent memory leak under load.

The thing is, if I just write the code myself, I have absolute control over the execution path. Because I build the mental model layer by layer while typing it out, my own code is fundamentally way more understandable to me than anything an LLM drops in my lap. I actually know why it works.

Instead, with AI, I feel like I'm trading the active problem-solving of writing code for the mind-numbing task of auditing code written by something that has zero actual intent.

How are you low-level devs actually integrating these tools without losing your sanity, your control, or your deep understanding of the codebase? Or are you just ignoring the hype cycle despite the kernel maintainers getting on board?


r/C_Programming 3d ago

Project MLP.h: Single-Header Neural Network Library in C

Enable HLS to view with audio, or disable this notification

206 Upvotes

I've been working on MLP.h, a single-header C library for building and training multilayer perceptrons, and I finally put together a complete example project around it: a handwritten digit classifier trained on the MNIST dataset.

The MNIST example uses a simple fully connected network:

784 → 128 → 64 → 10

The training program:

  • loads the 60,000-image MNIST training set
  • trains the network using MLP.h
  • serializes the trained model to mnist.mlp

A separate inference program:

  • loads mnist.mlp
  • exposes a small prediction API
  • is compiled to WebAssembly so the same C inference code runs directly in the browser

Training results:

Epochs     : 50
Final Loss : 1.31719803e-02

Test Accuracy: 97.71% (9771/10000)

I'll include a short video showing the browser demo recognizing handwritten digits.

I'm mainly looking for feedback on the library's API/design and the implementation. Suggestions for improving the architecture or the serialization format are also welcome.

MLP.h: https://github.com/px7nn/MLP.h

Live Demo: https://px7nn.github.io/MNIST/

Source of Demo: https://github.com/px7nn/MNIST


r/C_Programming 2d ago

Project Mojibake - Unicode text processing for C

4 Upvotes

I've created a library that adds Unicode segmentation, casing, collation, and more to any C project using a single source file and header amalgamation files.

Mojibake is an MIT-licensed project I started years ago because I didn't like any of the Unicode projects I found. Here you can find the API and a WASM demo if you want to try it on the fly: https://mojibake.zaerl.com/

If you are interested in the Unicode world, feel free to contribute or do whatever you want with it. Every suggestion or contribution is welcome. I automatically test on Linux/macOS/BSD/Windows, so I hope there won't be any problems for you.

Check CONTRIBUTING.md for it, if you are curious.


r/C_Programming 1d ago

New to c programming please help

0 Upvotes

I am currently reading kn king book about c programming a modern approach. What should i do after that? How should i build projects?


r/C_Programming 3d ago

C Project Recommendations

45 Upvotes

I'm looking for interesting C project ideas that go beyond beginner projects. What are the best C projects you've built or would recommend? GitHub repositories and project lists are also welcome.


r/C_Programming 2d ago

Project Nadir, platform-agnostic customizable assembler.

7 Upvotes

I made a customizable, platform-agnostic assembler with modern C23. Aside from the project itself, I think the codebase is relatively small and overall an example project to examine what C23 can provide :D

Here is the source code: https://github.com/mikuwithbeer/Nadir


r/C_Programming 3d ago

Discussion Why are you using C?

59 Upvotes

I have been often asked this question in the one year that I have been trying to make using C mainstream for myself.

Now I don't work on embedded devices or write operating systems. What I usually make are automation CLIs or write servers for something.

I guess that makes using C redundant since there are languages that would provide a better dev experience. But following the popular advice for projects, make something you use, this seems like the right thing to do for me.

I'm making projects that I would use and I'm using C for them. Unlike most C users that I have talked to, I do not stick to C99 but at the same time, I don't use C++ strings or compiler extensions. I use the C23 strict ISO standard.

So I suppose that again puts me in a spot that no one else is in. A guy who first goes to one of the oldest and verbose languages, then uses its latest standard but then never uses advanced features from compilers.

I just wanted to write this to put it out.

PS: To add to my strange choices pool, I do not use fixed width integers, since they are optional but I do use least width or bit precise integers.


r/C_Programming 3d ago

Question Where do we learn the windows.h library of C?

19 Upvotes

Pardon me if i have said something highly wrong or misleading since i am a really new beginner.

After learninng C's string.h, stdio.h, stdlib.h and string.h. I wanted to learn windows.h to further increase my knoweldge. But i cannot find a source to learn it, can anyone point me out?

big thanksss :)


r/C_Programming 2d ago

When Should a Library Pattern Become a Language Feature?

0 Upvotes

C has always valued simplicity, transparency, and control.

But many large C projects have created their own abstraction patterns over decades:

  • GObject/GTK object model
  • Linux kernel object patterns (such as VFS)
  • Generic programming through macros
  • Various interface and dispatch patterns

This raises an interesting question:

When does a repeated library pattern become something the language itself should understand?

I don't think the answer is simply "whenever something is useful." Many things are better kept as libraries.

A possible boundary might be:

  1. The pattern appears repeatedly in many mature projects.
  2. It represents higher-level semantics, not just a commonly used function.
  3. The compiler can make use of this information in ways that are difficult when it only sees the library implementation.

Also, not every language feature means giving up control. Some features are mainly about extending expressive power.

For example, features like inline and _Generic give programmers new ways to express intent without hiding important implementation details.

The harder cases are abstractions such as object systems, memory management, or execution models. When a language starts defining these concepts, there is a real trade-off between compiler-understood semantics and programmer control.

So the question is not "should C become a higher-level language?"

The question is:

What patterns have become common enough that expressing them directly is more valuable than repeatedly rebuilding them as libraries?


r/C_Programming 3d ago

crocodile.h: single-header SAT solver

14 Upvotes

This summer I've been working on a Minesweeper board generator, and under the hood it requires a powerful solver to determine whether the board is logically solvable. Instead of using an existing solver like MiniSAT, I chose to write my own for the learning experience.

One feature of crocodile.h is that it represents cardinality constraints natively (this generalises the usual CNF clauses), which fits Minesweeper well. It also implements CDCL, following Algorithm 7.2.2.2C in Knuth Vol 4B quite closely.

Based on the CROCODILE_TEST_HARNESS macro, crocodile.h can be compiled either as a library to use in other programs, or a standalone executable that runs cnf+ instances (cnf+ is a file format introduced by MiniCARD). I chose to put everything under one header so that it is easy to embed and build.

Besides a few basic optimisations, I have not done much to make it fast (it's on my todo list!). It performs much worse than MiniCARD on some test instances, particularly the waerden ones, but it seems good enough for Minesweeper board generation at least.

AI was used only for high-level direction (e.g. how to do conflict resolution with cardinality clauses, how to implement assumptions). I translated the high-level ideas into code myself.

https://github.com/greysome/hard-minesweeper/blob/master/crocodile/crocodile.h


r/C_Programming 2d ago

Discussion Suggestion

0 Upvotes

Hi all I am beginner in coding. So I have college in 20days (1st year btech) should I learn python or c. In college they start with C. So as they teach C in college should I learn python seperate or go with

C.Pls suggest me


r/C_Programming 3d ago

Small C89 printing library with a custom formatting pipeline

3 Upvotes

I wanted to make a lightweight printing library for C89 without using a format string parser like printf.

The main idea is using a context-based pipeline system:

file_print(stdout,
    arg_str_lit("Value: ")
    arg_dec(value)
    arg_str_lit("\n")
);

The arg_* macros expand into small writing operations that share a print context. Each operation returns a state, allowing the chain to continue or stop when an error happens.

Some features:

  • C89 compatible
  • Single-header style (PRINT_IMPLEMENTATION)
  • Output to:
    • FILE *
    • fixed buffers
    • custom string targets
  • Integer formatting:
    • decimal
    • hexadecimal
    • octal
  • Floating point formatting (in a basic level)
  • Optional printf backend
  • Optional removal of string.h
  • Configurable output functions

The implementation is built around a context:

struct {
    type;
    target;
    written;
    status;
} print_ctx;

and all writers operate on that instead of knowing where the output goes.

I know this is probably not something that replaces printf (which is a whole world by itself and extremely powerful, especially for runtime formatting), but I was interested in exploring what a small C89-friendly formatting API could look like without variadic functions or a format string parser.

I would appreciate feedback.

github: https://github.com/byfanes/print.h/
codeberg: https://codeberg.org/fanes/print.h


r/C_Programming 2d ago

Why is the C23 standard still paywalled?

0 Upvotes

C is one of the most important programming languages ever created. It underpins operating systems, compilers, databases, embedded software, networking stacks, and a frankly absurd amount of the modern computing world. Yet if someone wants to read the final, authoritative specification for the language, ISO expects them to pay CHF 227 ≈ USD 281 for a PDF.

What exactly is the goal here?

Are compiler writers supposed to expense it? Are students supposed to? Are library authors supposed to work from a draft and hope nothing important changed? Are teachers supposed to explain that the definitive rules of the language are available only to people whose employers have standards-library subscriptions?

And to address the common responses I've seen, yes, I know that public working drafts exist. And yes, they are usually close enough for practical purposes. But “close enough” is not the same thing as freely publishing the actual standard.

This probably does not meaningfully inconvenience established C users, because public drafts, compiler documentation, and years of accumulated knowledge fill many of the gaps. But “go find the right public working draft and assume it is close enough” is a bizarre access barrier to throw at newcomers. The final normative text should be the easiest version to access, not the hardest.

The other standard justification I've seen is “How else do you expect the people who work on the standard to be paid?”

  1. The committee members doing the technical work are generally either unpaid volunteers or supported by their employers, universities, or research institutions, not paid royalties from individual PDF sales by ISO. Whatever costs the standards process incurs, it is difficult to believe that placing the language specification behind an almost $300 paywall is the only viable funding model.
  2. Other languages manage to publish their specifications freely. One cannot seriously argue both that C is foundational infrastructure and that there is no possible way to fund its standardization without restricting access to the definition of the language itself.

This model may have made some institutional sense decades ago, when standards were printed, mailed, and mainly purchased by corporations. For a programming language in 2026, it is indefensible. The cost of distributing a PDF is effectively zero, and the value of broad access is enormous. Open specifications improve education, independent implementations, tooling, documentation, compatibility, and public scrutiny.

Other language ecosystems understand this. You can freely read the specifications and reference material for languages and platforms that actively want developers to use them. Meanwhile, the official definition of C is treated like a proprietary industry manual. And then people wonder why programmers rely on Stack Overflow answers, compiler behavior, folklore, blog posts, and half-remembered rules instead of reading the standard.

A language specification should be public. Paywalling it does not protect the language. It does not meaningfully fund innovation. It just creates needless friction around knowledge that should be universally available. ISO needs to drag its publishing model out of the previous century.

Sorry for the rant, friends. I just got all riled up about it. Curious to hear your thoughts as always :)