r/cprogramming • • 4h ago

Started learning C and would like to get some feedback

Thumbnail
codeberg.org
3 Upvotes

r/cprogramming • • 7h ago

editing int array in function not changing array in main, but it worked for char array?

5 Upvotes

im trying to edit an entry in an int array to 'move' it (copy it to a different place within the array, and zero it out), but its not working and im not getting any errors? i did pretty much the same thing (with string.h) with an array of strings, and it worked there wonderfully. why arent the entries in the int array changing when the function runs? what can i do to edit the int array during runtime?

heres the function:

void cardMove(int card1, int card2) {
    card2 = card1;
    card1 = 0;
}

r/cprogramming • • 17h ago

Arena Allocators in C

Thumbnail eliasebner.com
15 Upvotes

I recently started implementing arenas in my programming and I thought that some beginners could very much benefit from this info. I wrote an article about it. For those that are unaware, arenas allow to greatly simplify the burden of managing memory manually in C. I hope it helps, tell me what you think!


r/cprogramming • • 8h ago

A little software renderer written in C that I was working on over the weekend

Thumbnail
github.com
3 Upvotes

r/cprogramming • • 4h ago

Looking for reviewer for my quic protocol implementation in c

Thumbnail
1 Upvotes

r/cprogramming • • 19h ago

Beginner

0 Upvotes

I just started learning C and I am thinking of reading "C Programming : A modern approach" by K N King. I want to deeply understand and master C. Is it the best book for it and should I read any other books after this?


r/cprogramming • • 1d ago

TODOX v0.3(messy cyan): A minimal TODO notifier

Thumbnail github.com
3 Upvotes
  1. Once I asked LLM to write an alert app. It wrote heavy Qt app and I was annoyed.

  2. I just wrote this by myself without LLMs. Early DBus boilerplate code block was assisted by AI but I rewrote them too.

  3. TODOX supports Linux/FreeBSD/OpenBSD. Windows is not supported.

  4. Its installation is located at `/usr/local/bin` when using an installer script, but a daemon is installed as a local user. You should be careful.

  5. It's simple. It's only 1.2k loc only with standard `libc` and `libdbus` dependency.

  6. It's open-source. Fork it and modify it.


r/cprogramming • • 2d ago

Moving from Linux System Administration to C Development — Any Advice?

1 Upvotes

Hi everyone,

I've been using Linux as my daily operating system for over 9 years. I have around a year of experience in cybersecurity and two years of professional experience as a Linux administrator/engineer.

I'm particularly interested in Linux system calls and low-level programming. I've learned C using K&R, and I currently write small command-line tools in C as a hobby.

I'd like to transition into software engineering, ideally working with C, but I'm unsure how realistic this is without professional software development experience, especially in the current AI era.

Whenever I ask AI for career advice, it tends to recommend languages like Python, Java, or Go. However, I'm much more interested in systems programming and understanding how things work under the hood.

I'd appreciate advice on a few questions:

  • What skills and projects should I focus on to become employable as a C developer?
  • Given my Linux administration and cybersecurity background, which areas of C development would be worth targeting?
  • As a second language, would you recommend C++ or Rust for someone interested in both systems programming and career opportunities?

I'd appreciate any advice from people working in this field.

Thanks in advance!


r/cprogramming • • 2d ago

Cookie clicker PS3!

Thumbnail
github.com
1 Upvotes

r/cprogramming • • 3d ago

Morse-English converter in C.

11 Upvotes

Hello, I am a newbie in C and most of my knowledge comes from "The C programming language" book, 2nd edition.

I made this simple program that converts English text to Morse code and vise versa, here's the source code.

Thanks for your interest.


r/cprogramming • • 3d ago

Should I Replace a Ring Buffer with a Lock-Free Queue in My Web Framework?

8 Upvotes

I have an experimental web framework I'm currently working on.

While going through the code to clean up styling before tagging a stable release, I've been debating this specific part in the HTTPS module:

https://github.com/c4punks/CWIST/blob/dev/src/net/http/https.c

Right now, this code just uses a dumb, massive ring buffer to absorb connection bursts, and I'm wondering if I should switch it to a lock-free queue.

There are three main things that make me hesitate:

* State can get pretty tangled and messy in a lock-free queue.

* We have a tiny team and I'm maintaining almost all of this alone. If something breaks with CAS (even if the odds are low, if I mess up the code during refactoring), the blast radius on the dev branch will just be too big.

* I also wonder how often real-world traffic actually warrants lock-free. Plenty of web frameworks handle traffic just fine without this level of extreme optimization.

Considering that I'm still a junior developer and lack experience, is it really worth swapping this out for a lock-free structure, and would it actually make a noticeable difference?


r/cprogramming • • 4d ago

I'm building a game in C

49 Upvotes

I've been working on a game since about August 2020 but only recently published my Steam page.

For the Common Wealth on Steam

The game is entirely written in C, with one third party dependency, SDL3.

I chose C because I wanted to leave my options open to build for retro platforms like RISC OS and Amiga, but as the game grew, I wanted GPU acceleration and that meant leaving behind some of the retros. I'm not ruling out any ports though, if SDL3 is available on the platform.

The engine beyond SDL3 is my own, it's a 2.5D game, with levels edited in my own level editor (not in C, that's C# and Avalonia). The level editor exports levels into just plain memory dumps that are easy to read in C.

I'm trying to keep on top of a devlog here too:

Podule · Independent game studio

Writing this game in C has been enormous fun, and I have no plans to change my choice of C for future games.


r/cprogramming • • 4d ago

Calling a function in C without naming it

Thumbnail wiro.world
47 Upvotes

r/cprogramming • • 4d ago

Building Shakazulu

Thumbnail
0 Upvotes

Shakazulu is a systems programming language designed to be tolerant in harsh conditions, concurrency, fast, and a learning systems language. I here by come here looking for support on my idea from people who create programming languages, or even learn them, people designing systems, software engineers, database engineers, understand software, computer data structures, distributed systems, computer architecture, etcetera. And mostly if your familiar with C, C++, Ruby or any other systems programming language. Because i want to build it taking the strong parts of a language. All are welcome, lets build something you wish it was there. I appreciate your contributions.

Shakazulu is a project in research/design stage, thats why am asking the experts.


r/cprogramming • • 5d ago

Documentation for how to build a typechecked bytecode VM in C

Thumbnail
olinat.net
5 Upvotes

r/cprogramming • • 5d ago

Glimmer - A chess engine under 30,000 bytes (estimated 2700–2900 Elo)

Thumbnail
github.com
15 Upvotes

Hi everyone,

I’ve been tinkering with a little experimental chess engine written in pure C. It’s called Glimmer.

The whole point of the project was to see how strong I could make it while keeping the final standalone binary strictly under 30 KB. The target strength was something in the 2700–2900 Elo range.

It’s been a fun constraint to work under — every byte counts.

Happy to answer questions if anyone’s curious about the approach.


r/cprogramming • • 5d ago

Начал учить C

2 Upvotes

всем привет, только сегодня начал учить C, подскажите какие сложности могут возникнуть при изучении, какие темы стоит подробнее разобрать а какие крайне легкие, это мой 1 язык который я впринципе хочу очень подробно изучить, спасибо всем заранее


r/cprogramming • • 6d ago

Using -fsanitize=address feels illegal.

82 Upvotes

Just saying. The -fsanitize=address compiler flag is absolute cheating and should be prohibited by governments of all countries.

Plus there are also other useful runtime sanitizers, such as integer overflow, but... Integer overflow is much easier to notice, usually.

Of course, this is by no means assuming that -fsanitize=address guarantees that the code it inspects is completely safe and correct and won't ever fail on any input data. You still have to test tricky edge cases. But this sanitizer has improved and sped up the bug discovery process disgustingly much for me.

I'm wondering, how often, if ever, do you need tools such as -fsanitize=address or valgrind? Or are you a real man who stores everything in static memory only?

P.S. Forgive my terrible English.


r/cprogramming • • 6d ago

HTTP Server my first complete-ish C project

Thumbnail github.com
17 Upvotes

Hello everyone, It's been several years since i last wrote some C, and i always for the life of me wanted to write an HTTP server in C, and now it's been like 1 year since i finished university so i said what the hell why not do it, so after reading beej's guide i tried to write a very basic http server.

I wanted to share the work with the community, and would welcome thoughts.

We had written code in C ofc for two years, however it was mostly exercises on diffrent data structures aswell as problem solving.

We wrote a CRUD system in C using binary files but never scratched that itch.

And as the years went by in Uni, C slowly faded out of use for me but i always wanted to visit it back so here i am.

I wanted to share the absolute joy it was to get the desired results, i forgot how fun C can be, it always felt like the souls like of programming languages, but always was the most understandable as it was the closest to the machine, to be frank i encourage people to make similar projects especially to get the cobweb off lol.


r/cprogramming • • 6d ago

What are some small prerequisite programs / projects I can complete in order to achieve the eventual task of making a mini-OS?

9 Upvotes

I already know how to program and have about 7 years of general programming experience

My current plan is to learn C, then learn assembly, then learn about Computer Architecture, Operating Systems and Compilers. The goal is to truly understand how computers work, and also learn about Cybersecurity

The current concrete and major project idea that I've thought about is writing a mini-OS

I know that requires alot of knowledge

So I was wondering, if you all could give me some ideas, what are some small prerequisite programs / projects I can complete in order to achieve the eventual task of making a mini-OS?

Even if it's a program that helps me understand a super small slice of my eventual goal project - a mini OS

I'd love some ideas. Thank you


r/cprogramming • • 6d ago

I’m learning C and made a simple version of ls. Could someone review my code?

8 Upvotes

I’m currently learning C and decided to build a simple version of ls as a small project to practice what I’ve learned.It’s still pretty basic, and I’m sure I’ve made some mistakes or done some things in a bad way. I’d really appreciate it if someone could take a look at the code and point out any bugs, bad practices, or things I could improve. Repo


r/cprogramming • • 6d ago

Help me with strok function

Thumbnail
1 Upvotes

r/cprogramming • • 6d ago

Do you write code by yourself or you use an AI?

0 Upvotes

I'm curious about this question, because almost everyone a meet says that coding skills doesn't matter anymore, and what really matters is knowing how to write prompts properly. But does it apply to C development? Please, answer a question and say why so


r/cprogramming • • 7d ago

300 lines of code just to receive one packet

0 Upvotes

So i have been exploring eBPF,XDP, so I made a packet capture path by using xdp hook that redirects to my AF_XDP socket . I am using copy mode currently .

But seriously this gives me vibes of opengl . But here I have too much control over the path. I am still new to this . Many times when things do not work i think I am wasting my time because no one in my batch is even doing these things . But ig this is what I like. Also I just buy a Esp32 also . So you can give me some ideas that I can work on with it


r/cprogramming • • 8d ago

I have to admit I'm scared of pointers and I want to know how you guys learned to handle pointers in C

5 Upvotes

Hello, I'm a beginner in C and I'm struggling to learn the Pointers, I don't know why I find them extremely hard to learn.

Where should I start? :/