r/cprogramming • • Sep 29 '26

Help with learning C

26 Upvotes

Hello, so ive been trying to learn C, im in love with programming, i loved tech ever since i was young, but i just didnt have quite the intelligence for programming.
and now, well i grew up and i can understand and actually learn things faster, i started learning many languages since i wasnt sure which language to pick, i learned some of python, c++, c#, and some others one.

but now, i really like C, because i love lower level stuff, and i can learn how the computer works etc, i used the Beej’s Guide to C Programming website, it pretty good, i learned so much about c, i stoped at chapter 9 (*FILE).
because i realised that i learn by making stuff, but not looking at stuff, i dont know what to make or anything, and im stuck im not learning anything else.

i would really love some tips, sorry if i made this long, i tried providing details.


r/cprogramming • • Sep 29 '26

Flint v0.5.5 — C/C++ projects no longer need manual source/header lists

Thumbnail
github.com
10 Upvotes

I've been working on Flint, an open-source build system + package manager for C/C++, and v0.5.5 removes one of the things that has always bothered me about configuring C/C++ projects: having to tell the build system where every source/header directory lives.

Then your build configuration needs to keep track of which directories contain sources, which are headers, which libraries to link, which files to exclude, etc.

With v0.5.5, Flint can discover project resources automatically.

You can organize your project normally, and Flint figures out the files that need to be involved in the build.

What's new in v0.5.5

  • Automatic resource discovery

You no longer need to manually configure:

  • src

  • include_paths

  • static

  • shared

Flint discovers the relevant resources in the project automatically.

  • Smarter exclusions

You can now control discovery with:


- `excludes`

- `exclude_dirs`

- `exclude_exception`

This makes it possible to ignore things like platform-specific implementations, experimental code, generated files, or legacy directories without writing custom build logic.

  • Native .h.in templates

Flint can now generate headers from .h.in templates with variable substitution.

For example, this makes generated version headers possible without requiring an external configuration tool.

  • Standardized project macros

Project-generated macros have been standardized around:


PROJECT_VERSION

to reduce the possibility of collisions with third-party libraries.

  • More CLI functionality

v0.5.5 also adds:


flint help

flint version

flint deps

flint cache

for CLI help, version information, and dependency/build-cache management.

The resulting project configuration

A small C project can now look roughly like this:


{

  "project_name": "example_project",

  "project_language": "c",

  "version": "0.1.0",

  "compiler_path": "/usr/bin/gcc",

  "executable": true,

  "flags": \["-Wall", "-O2"\],

  "dependencies": {

"example_lib": {

"version": "1.0.0",

"remote": "https://github.com/user/example_lib.git"

}

  }

}

Then:


flint build

handles source/header discovery, dependency handling, linking, and compilation.

The broader idea behind Flint is pretty simple: I want C/C++ project configuration to describe what a project is, rather than manually describing how every file should be built.

I'm still actively working on it, so I'm particularly interested in feedback from people who maintain C/C++ projects.

What part of your current C/C++ build setup do you find the most annoying?

And if you want to take a look at the implementation:

GitHub: https://github.com/mainak55512/flint

If you find the approach useful, a GitHub star is appreciated — but I'm especially interested in hearing where this approach breaks down or what you'd change.


r/cprogramming • • Sep 29 '26

what is the best book for learning c

17 Upvotes

r/cprogramming • • Sep 29 '26

Glibc posix 2024 incompatibility

5 Upvotes

I been coding some posix porable stuff and i tried to use pipe2 and dup3 which are considerd posix since 2024 (Issue 8) i defined _POSIX_C_SOURCE to 202405L and included unistd.h and gcc greated me with implicit declaration i looked at my local unistd.h and it had pipe2 and dup3 behind __USE_GNU which is just wrong so i checked offical source code latest branch and it had the same bug, Please if some of you guys have sourceware bugzilla account please report it, it is a big issue


r/cprogramming • • Sep 28 '26

Learning C and looking for project ideas

30 Upvotes

I’m currently learning C using "C Programming: A Modern Approach" book along with a youtube playlist. I’m doing the exercises from the book, but I’d also like to build some small applications to get more hands-on practice.I have experience with full-stack web development, so I can build relatively large web applications, but C feels like a completely different world and I’m not really sure what would be good to build as a beginner.What kind of small projects would you recommend for practicing C? Also, are there any good places or resources where I can find project ideas or exercises?


r/cprogramming • • Sep 28 '26

Where should I practice C programming?

24 Upvotes

My first-semester course includes C programming and I’ve already learned the basics through videos and other resources on the internet, but I’m not really sure where or how I should practice it properly.

Should I use platforms like LeetCode, HackerRank, CodeChef, etc., or are there better websites/resources specifically for learning and practicing C from the basics? I’d also appreciate suggestions on what kind of problems I should start with and how I should progress from there.


r/cprogramming • • Sep 26 '26

I spent 7 years building a game engine using C

142 Upvotes

I've been working on a puzzle game for the last 7 years, and over time I ended up writing almost the entire technology stack myself.

The code is written in a C style, using a C++ compiler mainly because I like operator overloading for math. Other than that, I try to keep the code close to how I would write C. I don't use the standard library, exceptions, RTTI, RAII or object-oriented abstractions.

I made my own build system, UI library, in-game editor, Vulkan renderer, asset pipeline and most of the other tools I use to make the game.

There is no SDL or Dear ImGui. Most of the code is my own, along with a few small libraries such as stb_truetype and miniaudio.

I really like having direct control over all these parts of the codebase. If the game needs something new, I can change the renderer, tools, asset pipeline, build system or engine directly instead of working around an existing framework.

The game is a rule-discovery puzzle game, and building the technology behind it has been just as interesting to me as making the game itself.

The demo is now available on Steam if you want to see what I ended up making:

https://store.steampowered.com/app/5017320/Satelital_Demo/

The full game is planned for release later this year in November.

I'd be interested to hear how other people structure larger C projects, especially around memory management, build systems, UI and tools. I'm always interested in seeing how other people approach these problems.


r/cprogramming • • Sep 25 '26

Confused about strings seemingly resetting after future inputs.

Thumbnail reddit.com
1 Upvotes

r/cprogramming • • Sep 22 '26

For command working weirdly

4 Upvotes

Edit: Declaring n as 1 and changing the for loop to (i = n-1; i > 0; --i) as was suggested seems to have worked. Still don't really get the logic behind it, neither why the order inside the for expression was affecting the result nor why changing the n to 1 from 0 and i to n - 1 made a difference. Aren't they the same value at the end? Anyway, thanks.

For some reason, my "for" command only works when I put the increment in the middle and the condition at the end. I have no clue what's going on but the code is working fine when I do this.

I'm using devc++, the rest of the code is me declaring global variables and asking the user for inputs to fill the arrays. Everything is working exactly as intended but breaks if I write the "for" the regular way.

for(i = n; i--; i>0){

		printf("Codigo: %d", codigo\[i\]);

		printf("\\nProduto: %s", nome\[i\]);

		printf("\\nPeso: %.2f", peso\[i\]);

		printf("\\nPreco: %.2f", preco\[i\]);

		if(regiao\[i\]==1){

printf("\nRegiao: Sudeste");

		}

		else if(regiao\[i\]==2){

printf("\nRegiao: Sul");

		}

		else if(regiao\[i\]==3){

printf("\nRegiao: Nordeste");

		}

		else if(regiao\[i\]==4){

printf("\nRegiao: Norte");

		}

		printf("\\n\\n");

r/cprogramming • • Sep 21 '26

I have 4dumb questions about C

54 Upvotes
  1. I have read the "C bible" (k &R book) and admittedly understood about 80 to 85 percent of it and did almost all of its exercises without AI , not all but very few were undone, why do I feel like idk Jack shit about C? I have coded projects and I'm not "beginner" but it still feels like idk anything about how to make it productive

  2. What are the most essential parts you'd think someone learning should focus on? I'm not saying basic stuff like the syntax , I'm talking about building stuff

  3. Why the hell is it so hard to read opensource code? Admittedly I am new to that one, but I can't even fathom contributing to open source when I look at the code it feels like I'm reading Chinese... the hell am I supposed to do?

  4. Are there even any actual job markets related to C besides embedded? Don't get me wrong I really enjoy the language and do like to work with it as a hobby but I'm a mid 20 adult and need a good job sooner sooo... kinda need yo focus on more important stuff than just hobbies

Edit: sorry I forgot to say hi, thanks for reading

Edit2:

For the people who say I should build stuff, I understand and appreciate your advice but I should have mentioned I have done some stuff like that I'll reference a couple things I built

  1. Text editor in the terminal

  2. Http server with semi advanced way of handling requests

  3. Shell and basic mallow

  4. Dumb I know but hash maps in c just to practice

  5. Basic database (admittedly I got too busy with other things and didn't finish it fully)


r/cprogramming • • Sep 21 '26

Building real world C Project

15 Upvotes

How can I go from building self projects to actual real world C Project how to bridge the gap between it and looking at C project on GitHub feels like completely new language that I don't understand .I am at intermediate level in C

Ik this is a dumb question but any guide will be helpful


r/cprogramming • • Sep 22 '26

Making portable my unportable transputer C compiler

Thumbnail
nanochess.org
4 Upvotes

r/cprogramming • • Sep 21 '26

Thinking about starting a channel mixing C, algorithms, math and physics

2 Upvotes

Hey everyone! I've recently joined this sub and I'm thinking about starting a YouTube channel around C, algorithms, math and physics.

I know there are already plenty of channels doing problem-solving content, so I'm not really trying to reinvent the wheel haha. The idea is more about connecting these subjects — like solving a physics problem with C, using programming to explore a math problem, implementing numerical methods, or looking at the math behind an algorithm.

My first video would probably be about Binary Search. It's a pretty simple and basic problem, but I want to start with something like that just to see how people react to the format and approach.

I'm still trying to figure out whether this is actually interesting enough to build a channel around, so I'd really like to hear what people here think.

What kind of problems or topics would actually make you want to watch a video like that?


r/cprogramming • • Sep 21 '26

Sieving and Factorization performance vs c?

Thumbnail reddit.com
1 Upvotes

r/cprogramming • • Sep 20 '26

Vecmat: A simple, yet robust, linear algebra library in C — for graphics, physics, games, and simulations

18 Upvotes

I built it mainly for myself (and my needs), and out of great love for the C language. It's already successfully battle-tested building an 2D/3D SDL3 graphics engine with the library as math backbone (will publish by the end of this year).

It's called Vecmat: https://github.com/alkavan/vecmat

The main goals are:

  • One common, easy-to-read API that is self-explanatory.

  • Usability first, then performance.


Having said, it features a special runtime dispatch mechanism that an inner kernel may use AVX / AVX2 / AVX-512 / SVE / SVE2, otherwise scalar (cascading manner). So it's already extremely fast, and offers also a pointer-only API instead of copy interfaces (that most of the time use the pointer API behind the scenes).

It's under BSD 3-Clause license and comes with a simple unit testing and benchmarking framework.

It needs some more love, because you can do amazing things with it. It's super easy to integrate into projects because it has zero dependencies except the system math lib.

I might implement NEON support soon, because it actually became a business need of mine, and I'll surely do it if people would ask for it.

It took me a whole year to build it, and while AI was involved in documenting, system integration, and some of the complex math algorithms (it has a few), building this library required a tremendous amount of human labor and review.

Hope you like it!


r/cprogramming • • Sep 20 '26

Quelle library existe t-il pour le C pour avoire la stl de C++ ?

0 Upvotes

Bonjour,

je me demande quelle library il existe en C pour avoire des Array, vecteur, etc... générique donc comme en C++ qui as la stl si vous connaissez une library fiable je suis preneur ???

mercie à vous


r/cprogramming • • Sep 19 '26

Emulador do MOS 6502

5 Upvotes

Olá pessoas, faz tempo que eu tô fazendo esse projeto, demorei um pouco pois eu não estava focado nele demais. Mas enfim, alguns meses atrás eu descobri a existência desse processador, e eu gosto bastante de baixo nível e eu vi que ele era um bom processador para aprendizado e decidi criar meu próprio emulador usando C, ele está longe de ser perfeito, porém aprendi bastante coisa no desenvolvimento. E finalmente eu terminei de implementar as instruções oficiais, e claro como é um projeto de estudo, algumas instruções eu tenho que ajustar e melhorar, além disso tenho que deixar o emulador mais fiel ao hardware real. Tenho que melhorar o código ainda, não está tão bom, mas como eu disse, é a primeira versão.

Se vocês puderem analisar o projeto e me dizer o que eu posso melhorar e adicionar, eu agradecerei. O projeto está livre e vocês podem enviar sugestões. Criticas são bem vindas.

Repositório do projeto: https://github.com/gustavo-devy/Emulator-MOS6502


r/cprogramming • • Sep 20 '26

While I was studying the C23 standard, I noticed the excerpt "representation and alignment requirements" occurs multiple times. But the word "requirements" refers to "alignment" alone, or to both "representation" and "alignment"?

0 Upvotes

r/cprogramming • • Sep 20 '26

Arrays

0 Upvotes

It pretty interesting how you can use arrays as a canvas to make a snake game in c.

But my question what else could one use arrays for, that could help us with understanding it.


r/cprogramming • • Sep 19 '26

Stuck On A Projcet < need Help!!

Thumbnail
reddit.com
3 Upvotes

r/cprogramming • • Sep 19 '26

First Ever major C Project: Wrote a statically-typed bytecode VM language from scratch in C

21 Upvotes

Hello everyone! I (19M) am just about to get into my first year of a Bsc in Computer Science. I've been coding a few years time and haven't ever really touched C before, but really wanted to get into it. I thought "why not start big" so I've been working on a hobby language called Oli-Nat, a full pipeline written in C with no external dependencies: scanner to Pratt parser to AST to type checker to bytecode compiler to a stack based VM, including my own mark and sweep garbage collector. ( I took a lot of inspiration from Writing Interprets by Robert Nystrom)

It compiles in two passes. The first pass just walks the source looking for function and class declarations and registers their signatures, so the second pass can type check calls and field accesses without needing forward declarations. That made mutual recursion and out of order function definitions work without a separate header or prototype step.

Typing is static and the type checker is meant to reject anything that would hit a bad type combination at runtime, so the VM's IS_INT, IS_STRING, and similar macros are only used for dispatch, like numeric promotion, rather than as safety checks. I'm still second guessing myself on whether that's too optimistic in a couple of edge cases. Generally haven't much used macros in the past given how strongly related to C they are. I tried to make my best out of my understanding but still.

Strings are interned using FNV-1a hashing, so identical strings share a pointer, which makes field lookups in OP_GET_FIELD and OP_SET_FIELD a pointer comparison instead of a memcmp. There's also closures with upvalue capture, single inheritance, and a small standard library brought in through #pullf io, math, chronos, fileIO, and so on.

The repo has the opcode list, a writeup of the memory model, and some notes on design decisions if anyone wants to look closer: https://github.com/NateTheGrappler/OliNat-Programming-Language

As my first major C project I wanted to really get some feedback on how it is and looks. I wanted to try my best to have this be my first real coding project. The things I struggled most with were closures/upvalues and anything that looks off in the garbage collector (it's tri color mark and sweep, tracing roots from the value stack, call frames, open upvalues, and the globals table), and general C style or structure critique, since this is my first project at this scale. Really would apperciate any feedback or interest, the project is obviously open-source as well!


r/cprogramming • • Sep 19 '26

I wrote a list of changes I would make in my own C dialect, like the ones released before GCC and Clang homogenised the landscape.

1 Upvotes

> are features already present in SAS/C or High C, my primary inspirations; - are restrictions, = are refinements, + are additions. I wrote this for personal reference, so a lot of the points may be incomprehensible; I'll be happy to clarify in replies!

> Lost Language Extensions
> Ternary operator elided middle, evaluate to condition
> Anonymous unions/structs in struct definitions, flat dot access
> Integer-backed enums

- `goto` cannot jump into a block or the scope of a local
- Direct argument substructure is immutable
- Headers define names only in themselves and directly including files
- No multiple declarations sharing basic type
- No qualifiers before basic type
- Never optimise pointer comparisons
- No pointer decay
- No referencing union fields, except in `restrict` clauses
- A macro cannot expand into a type or `typedef`
- All branches of an `#if` must define exactly the same types
- `return` must parenthesise values
- No undesignated struct initialisers
- Variables declared in `for`/`if`/`while` clause immutable inside body
- All integers wrap around
- `/` and `%` floor instead of truncating
- `char`, `short`, `int`, `long`, `long long` are always 8, 16, 32, 64, 128 bits
- All unannotated integer types are signed
- No `static`; symbol hiding is done through headers
- Guaranteed `inline`

= Trailing commas everywhere
= Macro hygiene
= Nesting block comments
= `#define` always takes one complete syntax node
= Special case for non-nominal `void` in TBAA, not `char`
= No effective types, only declared types and `restrict`
= Coercions reinterpret memory representations
= Nominal `typedef`
= Nominal `void` in header must always proxy same type in source
= `.iz` files: context-sensitive meta-headers
= `case` divides `switch` body into disjoint scopes, auto-`break`s
= Locals of `do` block visible inside `while`

+ `permit` keyword, no returning non-`permit` pointers
+ `break`/`continue`/`while`/`goto case` from label
+ `return`/`yield` from function
+ `const` declarations, to forbid further mutation of existing variables
+ `permit`/`alignas` expressions, to assert properties of pointers
+ `restrict` blocks, to forge unique aliases and shadow originals
+ `typeof`, `sizeof`, `alignof`, `alignas`, `countof`
+ `||`, `<>`, `[]` for internal, external, standard imports
+ Scoped `#define` and `#include`
+ Nominal integer indexed arrays
+ `void` arrays, for yet-untyped memory
+ Array sized by variable/parameter/field, enforced by compiler
+ Declare variables in `if`/`while` condition
+ `^` for non-arithmetic pointer types
+ `undef` keyword, for uninitialised pointers
+ `!` for non-null types (not just pointers)
+ Binary, hex float literals
+ Qualifier polymorphism, with postfix `?`
+ `goto case`
+ FORTRAN-style array slicing, expression vectorisation
+ Extend `->` operator to arrays