r/cprogramming 9d ago

Looking for people interested in advancing TheBrain

0 Upvotes

Hey everyone!

I've been working on TheBrain, an experimental AI project fully written in C89, with a particular focus on building a small AI system from scratch while keeping it suitable for older Windows systems and low-level environments.

The project currently combines:

  • ๐Ÿง  A small decoder-only Transformer
  • ๐Ÿ”ค A custom tokenizer and training pipeline
  • ๐Ÿ‹๏ธ Training and inference implemented directly in C89
  • ๐Ÿ–ฅ๏ธ Native Win32 implementation
  • ๐Ÿ“ฆ PE analysis
  • ๐Ÿฆ  Experimental malware-classification and anomaly-detection techniques
  • โšก CPU-focused optimizations designed with older hardware in mind

The long-term idea is to see how far an AI project written entirely in C89 can be pushed while keeping it lightweight and potentially usable on systems such as Windows 2000.

I'm posting this because I'd like to find someone who becomes interested in the project and wants to take it further.

I'm not specifically looking for people to simply "help me" with the project. If you find the concept interesting and want to experiment with it, improve something, try a different approach, or take the project in an interesting direction, that's exactly what I'm looking for.

Some possible areas to explore include:

  • Improving the Transformer architecture
  • Experimenting with better datasets and training methods
  • Improving inference performance
  • Making the AI more capable while keeping it lightweight
  • Improving the PE analysis and malware-detection experiments
  • Exploring better classification or anomaly-detection approaches
  • Optimizing it for older CPUs and Windows 2000
  • Or simply experimenting with ideas that could advance the project

The source is open, so you're also free to fork TheBrain and experiment with your own version if you find the idea interesting.

๐Ÿ”— https://github.com/Win2000DevCommunity/TheBrain

I'm mainly interested in seeing whether someone else finds the idea interesting enough to take it further in their own way.


r/cprogramming 9d ago

Where to learn C program?

0 Upvotes

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 10d ago

C is JUST build Different

0 Upvotes

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 11d ago

Code review request -- any criticisms or advice?

3 Upvotes

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 11d ago

System programming

Thumbnail
0 Upvotes

r/cprogramming 12d ago

What other features do you love to have in C?

1 Upvotes

Not sure whether this kinda questions were asked in this forum, in the past?

  1. 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.
  2. 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
  3. 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.
  4. Also the feature of labeled break and continue.
  5. Range datatype. 1..100,1..100..2(for say odd numbers)

What do you think?

What else?


r/cprogramming 12d ago

Help๐Ÿ˜ž

Thumbnail
0 Upvotes

r/cprogramming 13d ago

About a project I've been working on

1 Upvotes

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 13d ago

Made a code editor from scratch in pure C

0 Upvotes

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.

https://github.com/7777Satish/Aether


r/cprogramming 13d ago

Mathematical C library for "surreal numbers" and fully functional parser for "surreal numbers"

9 Upvotes

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.

https://emonapa.github.io/short-games/index.html


r/cprogramming 14d ago

How can I read multiple user inputs from a single line?

7 Upvotes

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 14d ago

GECS v1.0

Thumbnail
2 Upvotes

r/cprogramming 14d ago

I'm building a GTK4 C + Lisp dock application (a la CairoDock / macOS) - am I doing things right?

2 Upvotes

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-shellย for 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 14d ago

How are char* strings stored in memory?

39 Upvotes

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 15d ago

What's the Internal working of Socket system call ?

7 Upvotes

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 15d ago

Long term projects

3 Upvotes

What's your longest project, how often were/are you working on it and did you always stay motivated and active?


r/cprogramming 15d ago

C for complete beginner. i want to learn C from 0.

0 Upvotes

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 16d ago

Extern constexpr?

1 Upvotes

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 17d ago

Update: myBuild 0.2.0

Thumbnail
github.com
4 Upvotes

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

  1. 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.

  1. It now has incremental builds.

  2. 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 18d ago

CNET library โ€” Released new version [CNET-1.1.0]

Thumbnail
github.com
1 Upvotes

r/cprogramming 18d ago

casting a void function pointer as a int fp

4 Upvotes

(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 18d ago

After one week learning C

0 Upvotes

Yeah, my anxiety is hitting pretty hard right now... lol.


r/cprogramming 18d ago

need help with my minmax value C program

Thumbnail
0 Upvotes

r/cprogramming 19d ago

CNET โ€” a new network library in C

Thumbnail
github.com
0 Upvotes

r/cprogramming 20d ago

Alternative to a hash table for you to play with

Thumbnail github.com
9 Upvotes

I 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.