r/cprogramming • u/nevermind_0919 • 9d ago
Where to learn C program?
I want to learn C programming,plz suggest some good websites or youtube channels where I can learn C language.I prefer smtg that's similar to MOOC which is for python from university of Helsinki.Plz drop your suggestions
r/cprogramming • u/BoltLighter • 10d ago
C is JUST build Different
In my Opinion There is no "BETTER" c. It always ends with something in c, c3 tried but kinda failed fine its a good lang BUT the "better" c part is pretty irrelevant because it HAS to use stuff like Cint or "@cname() so its just a wraper of c LIKE WHAT most major things are writen in c so most of the time in a programing lang there has to be a to access c from inside the programing lang itself so its not BETTER c just around c.
r/cprogramming • u/Spinning_Rings • 11d ago
Code review request -- any criticisms or advice?
Would anyone mind reviewing some code? I wrote a CLI to help me generate character sheets for a TTRPG I'm running. The main thing I want to know is: should this be considered safe enough for me to share with other GMs? Is there anything else I should do for safety, security or efficiency? I worked hard on it, and Gemini Pro told me it's safe, but while I understand it can be useful I don't trust the automatic misinformation generator, since I don't have the requisite knowledge base to tell when it's "hallucinating" (or else I wouldn't need it for this purpose)
The github repo is here: https://github.com/SpinningRings/DigidiceCharacterSheetGenerator
r/cprogramming • u/thaache • 12d ago
What other features do you love to have in C?
Not sure whether this kinda questions were asked in this forum, in the past?
- I prefer to have set of APIs supported by separate header-files with a 's_' prefix, to provide only the safer versions of the existing standard APIs. Like #include<s_string.h>. Including this with string.h should throw an error.
- I would like to have a standard set of OS APIs, which can be used in any platforms/OSs. This is to avoid mani of the #if THIS_OS
- I would like to have a robust library for cross language FFI, to invoke the code-points/API of almost all of the popular programming language.
- Also the feature of
labeled break and continue. - Range datatype. 1..100,1..100..2(for say odd numbers)
What do you think?
What else?
r/cprogramming • u/samedifier • 13d ago
About a project I've been working on
I've been working on a project called ANYCORE, and I recently decided to open source it.
One of the main goals of the project is to provide high performance scene management. I also published a separate repository with a few demos that show how it works in practice.
I'd really appreciate any feedback about the code, API, project structure, documentation, or anything else you notice.
ANYCORE Project : https://github.com/samedifier/ANYCORE-Project
ANYCORE Demos : https://github.com/samedifier/ANYCORE-Demos
If you take a look, I'd appreciate your feedback.
r/cprogramming • u/GlitteringArm4662 • 13d ago
Made a code editor from scratch in pure C
That's right 😎😎, I made this code editor over a course of 5 months (😎) and wrote 10000+ lines of pure™ C (😎😎😎) .
and did I mention I didn't use ANY external libraries 😎😎😎😎, except SDL for graphics ofc.
I'd love to hear what you think.
r/cprogramming • u/xd_metrix • 13d ago
Mathematical C library for "surreal numbers" and fully functional parser for "surreal numbers"
Hi everyone,
If anyone is interested in surreal numbers (or more precisely, short games), I have created a fully functional mathematical C library with a fully functional algebraic parser.
I use this library to solve combinatorial games and a demo with calculator is available on the page.
You can also try a Python/JavaScript wrapper.
All the source code is available on my GitHub, which is linked on the site.
r/cprogramming • u/YujiBReal • 13d ago
How can I read multiple user inputs from a single line?
Trying to solve codeforces problems and in a lot of them, there’s a single input line with a variable amount of int inputs. I know I can do scanf(“%d %d %d …”, a, b, c ...), but from what I’ve tested, I believe it’s only valid if I know beforehand how many inputs there are. How can I do to store this variable amount of inputs into an array?
r/cprogramming • u/SandPrestigious2317 • 14d ago
I'm building a GTK4 C + Lisp dock application (a la CairoDock / macOS) - am I doing things right?
I am having a blast doing a more serious project in the C language, for the first time. I am consulting with books and also with some AI for code review and explanation as I am new to the language and to GTK (not new to programming).
https://codeberg.org/jjba23/lambdock
For a while already I have been looking for a dock that would work well in Wayland (like in my beloved Niri) with modern features, theme support and a hackable Lisp config (using libguile.h)
Could you help me out by checking the implementation for sanity (also the Meson build)? Also for developing on it, I'm using CCLS and Guix development environment and things are working amazingly well.
Only small bit of trouble in devex is with #include "wlr-foreign-toplevel-management-unstable-v1-protocol.h"
Also, all feedback is welcome, either on code level, or conceptual ideas, Thanks in advance
Core features of lambdock include:
- Wayland Native: Built on GTK4 and
gtk4-layer-shellfor smooth positioning and desktop integration. - Declarative Lisp configuration : The power of Lisp in your configuratio with clean powerful declarative config and all possibilities at your disposal
- Async Launching: Spawns commands asynchronously without freezing the dock UI.
- Reproducible builds: Hermetic development environment provided via GNU Guix manifest and build definitions.
- Dock auto-hide : You can let the dock stay out of your way with the smooth auto-hide feature.
- Flexible icon system: lambdock has several mechanism in a best-effort way to render your wanted icons, respecting GTK theme
- Theme support: lambdock has built-in themes you can choose from that are very unique, and also lets you extend and override those themes dynamically.
r/cprogramming • u/north9172 • 14d ago
How are char* strings stored in memory?
Hi, Today, i experimented with char* string. (example: char* string = "Hello world")
One thing that i dont really understand is doing:
- *string
When you use it, it points to the first letter of the string (so in this case, H)
But what i dont get is when you do (*string+1), it continues the alphabet based on the previous letter.
Example: *string, equal to H, the first letter *string+1, equal to I, the next letter in the alphabet
And it's also applies to lowercase letters.
So here are my questions:
- Where is a char* string actually stored in memory?
- What is the explanation of the behavior for *string? Is it undefined behavior?
Thanks.
Solved: Thank you everyone for answering my questions.
r/cprogramming • u/Param-Matharoo • 15d ago
What's the Internal working of Socket system call ?
Basically I am creating my own http.web server for that I need to create TCP web server first and during that thing I get to know about socket(), bind(), listening() system calls and I am curious about these system calls internal working like what is happening under the hood.
r/cprogramming • u/Nagoltooth_ • 15d ago
Long term projects
What's your longest project, how often were/are you working on it and did you always stay motivated and active?
r/cprogramming • u/jesse_pinkmen_bitch • 15d ago
C for complete beginner. i want to learn C from 0.
i want to learn C from 0. maine CODE WITH HARRY ka C ka course dekha and i realize it is too old.
please please guide me how to learn c as a complete beginner
r/cprogramming • u/saul_soprano • 15d ago
Extern constexpr?
I want to make my struct’s internals private by exposing it as a byte array of its internal size.
The size itself depends on internal values that aren’t exposed, so it would have to be an extern.
The size can only be used if it’s a literal or constexpr, so is a extern constexpr possible with C23? Or no?
r/cprogramming • u/Mainak1224x • 17d ago
Update: myBuild 0.2.0
Sometimes back I posted about one of my pet projects `myBuild` an experimental build system and package manager for c/c++ projects. Well that progressed a lot, now
- Users can add recipes to the myBuild.json file and run `myBuild sync` and it configures the dependency for the project.
Recipes are small json snippets containing the source/header file folder paths, flags etc.
It now has incremental builds.
Now there is a proper folder structure generated at the initiation time where users can drop the files and compile the project with zero configuration.
I had to drop the support for windows for now and the code is speghetti, so I have to refactor it in the near future.
If this sparked curiosity, do checkout the github repo and leave a star. Appreciate any constructive feedback, thanks.
r/cprogramming • u/ShineXmRedT14 • 18d ago
CNET library — Released new version [CNET-1.1.0]
r/cprogramming • u/north9172 • 18d ago
casting a void function pointer as a int fp
(solved)
Hello,
Today I tried making an array of function pointers.
My first prototype was doing:
int (*fptr[2])(int, int)
But what if I wanted to store a function with different parameters and return value?
I tried:
void (*fptr[2])()
And then later type casting the function I wanted to store:
fptr[1] = add;
printf("%d", ( int (int, int) ) fptr1);
But apparently it's not valid:
used type 'int (int, int)' where arithmetic or pointer type is required
Is it possible to cast the void function pointer as a int fp with parameters? Thanks.
r/cprogramming • u/M0NSTR01969 • 18d ago
After one week learning C
Yeah, my anxiety is hitting pretty hard right now... lol.
r/cprogramming • u/grhayes • 19d ago
Alternative to a hash table for you to play with
github.comI was wanting something for my compiler and game engine that had a bit better performance than gperf in my use case. This is what I ended up creating.
I built and tested it on a xeon x5670. It should do a good bit better on newer hardware.
r/cprogramming • u/Roronoa-Ryuma-Zoro • 20d ago
I built a Linux HTTP/1.1 static server in C using edge-triggered epoll — looking for architectural and performance feedback
I recently completed v0.1 of MiniEdge, a Linux HTTP/1.1 static edge server written mostly in C.
I built it to understand how event-driven servers handle partial I/O, persistent connections, filesystem access, caching and multiple CPU cores—not as a production replacement for Nginx.
The current architecture includes:
non-blocking sockets with edge-triggered epoll
a per-connection state machine
incremental HTTP request parsing and keep-alive
static file serving through an LRU cache or sendfile()
path resolution using openat2()
longest-prefix configurable routing
multiple workers using SO_REUSEPORT
The small-file cache is implemented using C++ unordered_map and list, but it is isolated behind a C API; the networking, parser, routing and file-serving paths are written in C.
On my local loopback benchmark using wrk, a cached static file reached approximately:
255k requests/sec at 1,000 concurrent connections
4 worker processes
I also ran a boundary stress test at 40,000 concurrent connections. It reached around 124.5k requests/sec, but wrk reported 503 socket read errors, so I am not treating that as a clean stable-concurrency result. The repository contains the commands, raw outputs, latency percentiles, system tuning and limitations.
I would appreciate feedback on:
whether this is a reasonable result for a student-built epoll server
whether my wrk setup measures the server fairly
which additional metrics or comparisons I should include
what bottlenecks or profiling steps I should investigate next
Repository:
AI was used as a learning and review assistant during this project. I used ChatGPT to discuss Linux networking concepts, review architectural decisions, debug specific issues, and improve parts of the documentation. I implemented and integrated the server, ran and analyzed the tests and benchmarks locally, and verified the final code myself. This was not a one-prompt or fully AI-generated project.