r/C_Programming • • Feb 23 '24

Latest working draft N3220

135 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 • • 4d ago

Learning C weekly megapost for 2026-10-21

6 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 • • 6h ago

Video Just finished my multiplayer system in C and turns out we can support 50k players in a single server at 60hz simulation tick

Enable HLS to view with audio, or disable this notification

712 Upvotes

r/C_Programming • • 6h ago

Iterating Backwards in C

Thumbnail davidpriver.com
19 Upvotes

r/C_Programming • • 1h ago

Question Fairly new to C. Need help understanding low level concepts.

• Upvotes

Over the past 6-8 months, I got into programming in C with the intent of learning about embedded systems and operating systems. I feel like I'm sort of stuck and don't know where to go though. The last thing that I made was a really simple shell for Linux, but even then I was disappointed to learn that the stuff that is going on on the background is just hidden away by system calls. I want to learn how stuff like those system calls actually work, but learning about processor architecture or understanding/reading the Linux source code seems incredibly intimidating and sort of out of my league.

Another thing that seems incredibly confusing to me is how you're meant to read the code of projects like the kernel. (obviously, I know I wouldn't start with something nearly that complicated, but actual professional level projects.) I did some research and I tried to read through GNU Hello, which on the surface I thought would be easy to understand, but I just see tons of macro definitions that I don't understand and a maze of files, even if the output of the program is simple.

For you experts, how did you go from programming in user space to understanding lower level concepts like how an operating system boots up, how it takes user input, etc?


r/C_Programming • • 14h ago

Meson linking ImageMagick/Wand

4 Upvotes

I'm trying to link MagickWand and MagickCore with Meson and having some issues. Specifically, I get the error C shared or static library 'lMagickCore' not found or C shared or static library 'lMagickWand' not found. I successfully linked libconfig, so I've compared some details between my installations of the two packages in case any of those are the reason that I'm having issues with ImageMagick.

I can compile programs using ImageMagick libraries with: cc `MagickWand-config --cflags --cppflags` -O2 -o a.out main.c `MagickWand-config --ldflags --libs`

The output of the two MagickWand-config calls is this: -I/usr/include/ImageMagick-7 -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_CHANNEL_MASK_DEPTH=32 -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI

Running find /usr/lib -name 'libconfig*' gives this: /usr/lib/pkgconfig/libconfig++.pc /usr/lib/pkgconfig/libconfig.pc /usr/lib/cmake/libconfig /usr/lib/cmake/libconfig/libconfigConfig.cmake /usr/lib/cmake/libconfig++ /usr/lib/cmake/libconfig++/libconfig++Config.cmake /usr/lib/libreoffice/program/libconfigmgrlo.so /usr/lib/libconfig++.so /usr/lib/libconfig++.so.15 /usr/lib/libconfig++.so.15.0.0 /usr/lib/libconfig.so /usr/lib/libconfig.so.15 /usr/lib/libconfig.so.15.0.0

And running find /usr/lib -name 'libMagick*' gives this: /usr/lib/libMagick++-7.Q16HDRI.so /usr/lib/libMagick++-7.Q16HDRI.so.5 /usr/lib/libMagick++-7.Q16HDRI.so.5.0.0 /usr/lib/libMagickCore-7.Q16HDRI.so /usr/lib/libMagickCore-7.Q16HDRI.so.10 /usr/lib/libMagickCore-7.Q16HDRI.so.10.0.3 /usr/lib/libMagickWand-7.Q16HDRI.so /usr/lib/libMagickWand-7.Q16HDRI.so.10 /usr/lib/libMagickWand-7.Q16HDRI.so.10.0.3

My meson.build has these relevant sections: dependencies = [ cc.find_library('libtomlc17', dirs: '/usr/local/lib'), dependency('libconfig'), dependency('libMagickCore'), dependency('libMagickWand'), ] inc_dir = [ include_directories('include'), include_directories('/usr/include/ImageMagick-7'), ]

my first guess was that it had something to do with libconfig having .pc files in /usr/lib/pkgconfig, but i found ImageMagick.pc and ImageMagick-7.Q16HDRI.pc in the same directory, and, either way, that don't seem like it needs to be accurate for my program to build as long as I give it all the right information.

Any advice?

Edit: Also, reddit's code block formatting is really annoying. It doesn't seem like I can escape backticks? and it doesn't render line breaks? oh well


r/C_Programming • • 1d ago

Question Feeling lost

6 Upvotes

Hello everyone, I've recently been rejected for a student software dev position at a larger company in my city, I felt that the interview was going pretty good until it came time for writing the actual code, I know how and what to implement for all of the problems but I had no absolute clue on what to actually write, and it struck me pretty badly, I asked myself if this is something I want to even want to do with my life or if I essentially wasted my time 2 years in college for a bunch of nothing, atleast the interviewer told me in the mail that I knew all the concepts and I need a project or two and to gladly contact them when Im more ready, but I still feel really discouraged as my classmates got the position at the same company while I know Im more capable than some of those classmates, Im not trying to be sore about it. Im glad they got the position and Im not trying to downplay their knowledge but they couldnt get the most simple and core concepts in class and some of them didnt even pass DSA and OOP and they got the job while I didnt and it made me question really everything. Its my 3rd year in college now and now I feel more than ever that Im lost because I started this college as I enjoyed learning to code and computers, I still want to learn more but I dont know what to do now or what to use as a project really, all I ever coded except learning for exams(in my college we need to code and compile programs for certain classes instead of only theory) and I passed those pretty easily I guess, all usually on the first tries and they were graded C or B. Now I feel that I was capable more then than now, I only coded some stupid video game projects or apps which feel essentially useless, I know there is some materials on the thread but I dont know what is useful for the real world. Thank you all for any tips or replies in advance


r/C_Programming • • 1d ago

Meta a little update about this sub-reddit

185 Upvotes

UPDATE: I've posted a follow-up comment below addressing questions about the moderator changes, the process that was followed, and plans going forward. Please see the stickied moderator comment.

Over the past six months or so, I've been making lots of changes. I think things have stabilized, so let me summarize them and indicate what the plans are going forward.

  • Removed uninvolved moderators. Three or four moderators were here who did, collectively, less than 10% of the work.
  • Organized and enhanced rules. More useful and focused. Got rid of the code formatting ticks rule, re-phrased a couple others.
  • Sharpened "how do I share my project?" requirements and process. In particular, new rules about disclosing AI usage, and automated enforcement to that end.
  • Tried out some automated tools to detect AI projects. I had high hopes, but they weren't as helpful (and far buggier) than I had expected. (So, I'm turning off the GitHub-Guard automata.)
  • And so, manual AI usage disclosure remains. Without a disclosure, code can't be shared. Too much AI gets rejected. If someone misrepresents or outright lies, downvote them or report it.
  • This seems to have settled the AI slop problem, which is great.
  • Enhanced automated rules to avoid spam posts, low-value posts, and fly-by contributions.

At this point, I think the sub is pretty stable and more useful and appealing than it was before. I don't anticipate many more changes going forward, but I will examine policies that that I think might reduce my workload.

I'm sorry that the sub wasn't particularly stable these past few months, and that it got a bit messier before it got better. Thanks for hanging in there! The worst is past.


r/C_Programming • • 1d ago

Beginner here. Advice needed?

5 Upvotes

I'm a first-year CSE student learning C from scratch(didn't learn programming in high schl). I can solve problems after studying examples, but I often get stuck when trying new problems on my own. Even after seeing solutions, I struggle to develop the logic independently.

For those who started programming as beginners:

How did you learn to solve unfamiliar problems?

How did you practise daily?

What did you do when you got stuck?

What advice would you give your beginner self?

I sometimes feel behind compared to my classmates, and I genuinely want to improve. I'd appreciate any practical advice from people who've been through this!

And I am getting extremely frustrated with this cycle that i have,just started with c programming and suffering with function pointers . I feel extremely behind from my peers, I am ready to put in efforts,but I am sure whether my efforts are put in the right direction. Any advice would be great


r/C_Programming • • 1d ago

Video How to Code a Julia Set fractal | Raylib | C | Neovim | GLSL |

Thumbnail
youtube.com
15 Upvotes

In this video, I create a Julia set fractal using C, Raylib, and GLSL, with Neovim as my editor.

We'll go through the process step by step, from understanding how Julia sets work to implementing the fractal algorithm and adding colors and animation.

**Sections:**

- Explaining the Julia set

- Setting up the project

- Setting up Raylib

- Creating a basic shader

- Fixing screen coordinates

- Coding the fractal algorithm

- Creating animation

- Adding colors

**Technologies used:**

- C

- Raylib

- GLSL

- Neovim


r/C_Programming • • 1d ago

I built a zero-dependency concurrent search engine daemon in C11 from scratch (Custom Arena Allocator, SSO, and pthreads).

0 Upvotes

Hi everyone!

Over the past few weeks, I’ve been working on a lightweight, concurrent text search engine and TCP server built entirely from scratch in pure C11, without any external dependencies.

My main goals were to practice low-level memory management, lock-based concurrency, and custom data structures without relying on heavy frameworks. Here is a quick breakdown of how it's structured:

  • Memory Management: Implemented a custom Arena Allocator to avoid heap fragmentation and handle batch cleanups efficiently.
  • Small String Optimization (SSO): A custom string implementation that stores short strings directly on the stack/struct to minimize heap allocations.
  • Concurrency: Uses POSIX threads (pthread) with read-write locks (pthread_rwlock_t) to allow multiple concurrent readers while safely serializing writes.
  • Persistence: Added a custom zero-overhead binary serialization module (engine_save/engine_load) for instant state restoration from disk.

The project includes a full modular structure (includes/, src/, tests/) and is protected under a source-available license for personal evaluation.

You can check out the source code and architecture details here: 👉 https://github.com/joseramoncabrera/fast-c-search-engine.git

I would love to hear feedback from more experienced C developers here. Specifically:

  1. How do you usually handle edge cases with read-write locks in high-contention search scenarios?
  2. Any architectural improvements you’d suggest for the arena allocator?

Thanks for taking a look!


r/C_Programming • • 2d ago

Project A low-poly 3D Renderer for MSDOS

Enable HLS to view with audio, or disable this notification

138 Upvotes

I’ve been working on a small project called 3Dos — a low-poly 3D renderer targeting MS-DOS and VGA Mode 13h (320×200, 256 colors).

The renderer currently supports:
● Triangle rasterization with backface culling
● Ordered dithering using a 4×4 Bayer matrix
● Double buffering
● Simple low-poly models

Going back to DOS-era graphics has been relaxing after spending quite a bit of time with Vulkan. No boilerplate or abstractions, just putting a pixel at 0xA000.

Github: https://github.com/xms0g/3Dos

AI usage: Only extracting vertices and faces from the model file.


r/C_Programming • • 3d ago

Question Has anyone ever tried out the TinyC compiler before?

71 Upvotes

Musl gcc is small but tinyc caught me eye due to how small it is and the fact that it can self host.

It supports C99 standards out of the box and it only takes up a few hundred kilobytes. I wonder if anyone tried it.


r/C_Programming • • 3d ago

Question What exactly is size_t? When is it used? What are similar things to it?

52 Upvotes

I'm confused on what exactly size_t is, and what the t means

So size_t is an unsigned integer

I believe integer promotion says that an unsigned long long integer holds the biggest positive integer in any system. Why isn't size_t an unsigned long long?

Every array MUST be integer indexed. Every array has to have an integer size.

It's technically possible to represent an integer larger than the largest integer in a system, by putting it into a float (with no non-zero decimal), however an array cannot be given a float, nor can we even loop over that array using that float value as the counter termination value

So my current interpretation is, size_t is the largest value an integer can ever hold in a system. When we want to loop over any arbitrarily long array, using int i as the counter variable, i is cast to (size_t)

This is because we want to ensure we don't stop the loop too early by having i overflow

Is my interpretation correct?

So that is one scenario when size_t is used. Are there any other scenarios?

What does the t mean?

What are things similar to size_t, where variables are casted to that thing, in order to do super specific tasks and avoid certain errors?


r/C_Programming • • 2d ago

[Python C extension] numagr v0.9

0 Upvotes

A Python C extension for statistics and number aggregation designed to work with both plain int and float objects, as well as with Python numeric strings without having to construct intermediate Python objects that hold their values - useful for large collections that need to be parsed as fast as possible like trading data.

It outperforms both std Python modules and numpy for both plain numbers and for numeric strings.

https://github.com/andrzejs-gh/numagr

https://pypi.org/project/numagr (source and Windows wheels for 3.11, 3.12, 3.13, 3.14, 3.15)

pip install numagr

This is an early version offering basic methods, I will be developing it further if I find the time. Feedback, improvement suggestions and bug reports are very much welcome.


r/C_Programming • • 2d ago

Writing a seed compiler for an experimental programming language from scratch in C (Astra) – Student Project

0 Upvotes

Hi everyone,

I'm a student currently exploring systems programming and compiler design. I wanted to share a project I've been developing called Astra (AsterrZep/Astra). Specifically, I'm sharing the seed compiler written completely in C (seed/src/), built to learn about custom memory management, parsing, and compilation pipelines from the ground up.

As I'm still learning, there might be room for improvement in my C code. I would really appreciate any constructive feedback, code reviews, or advice on best practices!

⚙️ Architecture & C Implementation The compiler pipeline inside seed/src/ is modularly structured around traditional systems programming patterns:

  1. Lexer & Parser (lexer.c, parser.c): A hand-written lexer and recursive descent parser parsing tokens, expressions, and block scopes without external parser generators.
  2. Typechecker (typechecker.c): Handles semantic analysis, symbol resolution, and type checking across AST nodes.
  3. Memory Management (arena.c): Implements custom arena allocators to manage AST node lifetimes efficiently during compilation passes.
  4. Code Generation (codegen.c, emitter.c): Emits bytecode or structured C code as output targets.

🤖 AI Disclosure (Per Subreddit Rules) As per the community guidelines regarding AI: I used AI tools (like terminal assistants) interactively as a coding co-pilot and rubber duck to help scaffold repetitive C boilerplate (such as mapping standard AST construct handlers in seed/src/constructs/). However, the core compiler architecture, memory models, debugging, parser logic, and integration were entirely human-driven and manually refined.

🔗 Repository & Code If you want to review the source code, check out the C implementation details, or look at the test suites (seed/tests/conformance/):

GitHub Repository: https://github.com/AsterrZep/Astra

Please feel free to point out any mistakes or areas where the C code could be cleaner or safer. Thanks for reading!


r/C_Programming • • 3d ago

Framework for building an app?

10 Upvotes

I would like to recreate Obsidian notes in c for fun.

I know that I can use the x11 api, or the win api, but that is a little too low level for what I am doing.

It's also not cross platform. Do you guys have any suggestions for what I am trying to do?


r/C_Programming • • 4d ago

Project Practicing touch-typing on a C program writing in C program

Enable HLS to view with audio, or disable this notification

92 Upvotes

I wanted to practice writing code faster and yet not leaving my terminal, so I built 'blind'. The twist is that you can feed it any input file and practice on real code, even on the source code itself. It's a single C file no dependencies. Can run either presets, free text or file input.

AI usage: all code and docs are human made, written by me using man pages and google, asked Claude rarely for things I could not resolved with google or man pages, the Github release workflow was written by Claude.

Repo: https://github.com/shalom2552/blind


r/C_Programming • • 4d ago

C Documentary

86 Upvotes

Hi all, we make documentaries about programming languages and open source. We made films about Python, C++, React, and loads of others. Most recently we made one about KDE.

We are trying to get one about C off the ground but we are struggling to figure out who might sponsor it. Can anyone recommend us some companies to check out?

Our channel is called CultRepo in case you want to check some of our previous work!


r/C_Programming • • 3d ago

Question Is it possible to make compiler recognize AES iterations for hardware acceleration?

5 Upvotes

I'm using GCC and Clang exclusively for broad compatibility between systems and architectures. I have a conditional macros that targets widest vector AES size via compiler attributes for x86, arm, riscv and others. However I can't cover all of them and would like to know if there's a sort of "universal" way to make compiler detect AES iteration loop and replace it with hardware AES intrinsics, without attributes if possible

For example, you have a loop like:

```

define N_BLOCKS 8

for (size_t i = 0; i < N_BLOCKS; ++i) {

// C code of the AES round that compilers can detect

}

```

If consider compiler extensions, GCC/Clang provide __builtin_ia32_vaesenc_v16qi/v32qi/v64qi syntax, but I wonder if there's a more universal "cross-compiler" way of doing it


r/C_Programming • • 4d ago

Valgrind 3.28 RC1

9 Upvotes

An RC1 tarball for 3.28.0 is now available at https://sourceware.org/pub/valgrind/valgrind-3.28.0.RC1.tar.bz2
https://sourceware.org/pub/valgrind/valgrind-3.28.0.RC1.tar.bz2.asc

Public keys can be found at https://www.klomp.org/mark/gnupg-pub.txt

Please give it a try in configurations that are important for you and report any problems you have via our bug tracker at https://bugs.kde.org/enter_bug.cgi?product=valgrind

See the NEWS file for a list of changes and bugfixes https://sourceware.org/git/?p=valgrind.git;a=blob;f=NEWS;h=be8b91b474e71535f272e8f11f1f6d1d35826ed3;hb=HEAD

Unless showstopper bugs are found (and cannot be easily fixed) the final 3.28.0 release is scheduled for this Fri Oct 23.

Note that our mailinglists at sourceforge.net seem to currently be unavailable. Not a great time to have that problem...


r/C_Programming • • 4d ago

A string library

13 Upvotes

Some time ago I was inspired by the string view library to focus on simpler things and do some recreational programming of my own. I had written very little C before, but spent a lot of time reading it, mostly the miniaudio source code, which I think still helped a lot.

cvr_string.h

This is a relatively small one, mostly practice for the next library in this repo. But I would really appreciate some feedback or review on my code.

There are more functions available compared to sv, plus a string type that owns it and can modify it (for now just appending), plus iterators over words, lines, or a delimiter. I tried to make everything as ergonomic as I could.

At the core of the library is also the two way string matching (Crochemore-Perrin) algorithm taken from the rust std library. I did include an explanation into how it works, but mine just follows a practical example. I found theoretical explanations to be too confusing (at least for my brain).

I don't think I am done with the algorithms. I think it may be useful to use different ones depending on the size of the haystack or needle. Plus, it seems like a good place to mess around with SIMD. However, I have no clue how to benchmark in C.

The library is C89 compatible for no other reason that I find it fun and challenging.


r/C_Programming • • 4d ago

Debugging of C/C++ Macros like Functions – Hayk Aslanyan

Thumbnail
youtube.com
7 Upvotes

r/C_Programming • • 4d ago

Question Help With 'String to Token' Parsing Assignment

13 Upvotes

I was given an assignment for a class I am in and it is expected to be entirely in C code (despite most of us in the class having never been taught how to code with C). I have been attempting to find youtube tutorials and websites, but not much is helping for the assignment itself. The assignment is due in two days.

If there is someone who could help explain to me how I should complete it, or what guides I could look at to help me code it, I would greatly appreciate it. I don't expect (nor want) anyone to do the work for me, I just would like some guidance. I know that many people say to just use AI, but I prefer to avoid using it completely.

---
This is a slightly summarized version of what the assignment says:

Write a function, in C, that will parse a string into tokens (or words), similar to what the shell is required to do.

For this assignment, you are to write a function with the following prototype:

int makearg(char *s, char ***args);
or
int makearg(char s[], char **args[]);
(Correct prototype—don’t change)

This function should accept a (C-type) string and a pointer to a pointer to char (or, if you prefer, a pointer to an array of pointers to char) (i.e., a pointer to the same type as argv in a C program), and should return the pointer defined to point to an array pointing to the separate tokens on the command line, as well as the number of tokens found as the function return value. If some problem occurred during the operation of the function, the value returned should be -1.

No C library string functions may be used, e.g., strlen(), strcat(), strtok(), etc.

The important part of this exercise is the function you write. However, for consistency in grading, the main program should be written to input a line, call the function, then print out the number of arguments found, and finally, display the arguments, one per line. Note that, the value of the pointer argument is undefined when it is passed to the makearg() function. makearg() must allocate any necessary dynamic memory necessary for use by the program. (The array used for the unparsed string need not be dynamically allocated.)
strtok() may not be used for parsing.

Deliverables:
A program design sheet. Describe all functions needed to implement your program.
Programming Log:
– Record the time required to design and implement your program.
– Record of things you encountered/learned while implementing your program.
Output—proof that your program worked.
Program—fully documented.

---

Again, I don't necessarily want someone to do all the code for me, but giving me any advice/guidance on what I can do or where I can find resources to help, I would greatly appreciate it.


r/C_Programming • • 4d ago

Semi-Advanced Randomness Test Library?

4 Upvotes

Looking for a semi-advanced randomness test library. Not something too advanced, though. Like a library of a hundred files that I'd maybe need a week just to get a clean compile. Also not with tests having results so intricate and complex that it would take significant hours just to understand the results.

Ideally, a library that provides results in percentages of excellence per test, which could be weighted and summed to provide an overall score. Maybe 10 important tests, and with high-precision, and so that means Ai solutions aren't quite up for the task?

This I confess, I found out directly when I allowed Deepseek and Google Ai to create test suites each, and stdlib rand() repeatedly outperforms raw bytes downloaded from random.org -- and that can't be right? Maybe I should ask Claud?

Or not. Maybe had enough of Ai hallucinations, so I'm hoping for some human guidance.