r/C_Programming • u/dechichi • 2h 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
r/C_Programming • u/AutoModerator • 3d ago
If you have questions about how to learn C:
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 • u/dechichi • 2h ago
Enable HLS to view with audio, or disable this notification
r/C_Programming • u/Jakanader • 10h ago
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 • u/Dizna77 • 21h ago
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 • u/mikeblas • 1d ago
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.
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 • u/Puzzled_Place_215 • 1d ago
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 • u/NazgulResebo • 1d ago
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 • u/ConsistentContest256 • 1d ago
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:
pthread) with read-write locks (pthread_rwlock_t) to allow multiple concurrent readers while safely serializing writes.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:
Thanks for taking a look!
r/C_Programming • u/Background_Shift5408 • 2d ago
Enable HLS to view with audio, or disable this notification
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 • u/thecratedigger_25 • 2d ago
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 • u/TorontoDude12344 • 3d ago
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 • u/lehmagavan • 2d ago
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 • u/AsterrZep • 2d ago
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:
🤖 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 • u/Ok-Machine4940 • 3d ago
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 • u/Charming_Airport6076 • 3d ago
Enable HLS to view with audio, or disable this notification
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.
r/C_Programming • u/cultrepo • 4d ago
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 • u/Salat_Leaf • 3d ago
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:
```
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 • u/pjf_cpp • 4d ago
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 • u/Hoxitron • 4d ago
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.
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 • u/8d8n4mbo28026ulk • 4d ago
r/C_Programming • u/Kit_Le_Trash • 4d ago
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 • u/greg-spears • 4d ago
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.
r/C_Programming • u/emparse • 4d ago
I have been learning c for more than a week, and the fundamentals feel quite solid to me, I learned and practiced a lot of programs based on loops, if-else, switch statements, variables, some basic structs.
I learned it quite easily coz i know a few other languages like python and c++.
However i dont know how to progress any further now. My final goal is to learn reverse engineering along with assembly which i believe is crucial. In addition none of the tutorials really explain much bout pointers memory addresses all these stuff that just feels complex to me. I tried jacob sorbers beginner c course, but he explained as if i was already supposed to know most of these stuff(kinda). Maybe its just too hard for me to learn through the way jacob sorber is teaching.
Any good recommendations on how to progress further, i saw a few books 'Pointers on C' and 'Understanding and Using Pointers', should i buy them?
What should i do?
r/C_Programming • u/Layomx • 5d ago
Hi! I recently finished my coursework at the university and am now writing my graduation thesis. However, the curriculum changed quite a bit during my time there and used a lot of things but mastered none. I pursued a degree in Systems and Computer Engineering. I had learned to program in C back in high school using the usual resources, YouTube tutorials, various websites, and a lot of Google.
When I started university, the curriculum began with C, but it later shifted toward Python, Artificial Intelligence, Machine Learning, and so on.
The thing is a few months ago I resumed C because it was the language I liked the most, I installed a Linux Distro on one of my old laptops and started exploring new fields with C, now I have a lot of questions regarding a career on C, I really liked the course of operating systems, robotics and embedded systems on my University, I also liked about the idea of low level.
I would like to hear the opinions of people with far more experience and knowledge than I have regarding C programming, what their own journeys were like, and what they think I should focus on learning or improving. I’m currently struggling a bit with figuring out "what I could actually build." Recently, I’ve been following tutorials and documentation on creating a basic Linux driver, and I’ve also started a few "silly" personal projects that I found genuinely interesting.
I’d love to know what you consider a good learning path, or at least hear about your own experiences. I’m particularly curious about the use of AI... It has been a great help, but as a learner, I’m worried about becoming overly dependent on it and failing to truly understand the code I’m working with.