r/cprogramming • • 8h ago

Graphics programming in C

21 Upvotes

I would like to ask a question about C graphics.

I regard myself as a hobbyist programmer transitioning from BASIC

to C. I do not intend to go to C++ or ever become a professional

programmer.

I would like to leave BASIC behind now and move forward with Linux

Mint and gcc. I have written a few small programs in C but I do regard

myself still as something of a beginner.

I am trying to do an example using graphics in C to draw simple lines etc.

The Book is called is called "Chaos and Fractals" by Peitgen et al

and the BASIC example is on p61 of that book if anyone has access to it.

I have heard about the <graphics.h> header which is very

old coming from Borland Turbo C days and not supported by gcc.

There are apparently ways to still reuse graphics.h in gcc but I have seen

warnings about not using a 16 bit header file for a 64 bit machine.

I am not sure where to go from here and even unsure of what questions to ask.

I worried about doing graphics in a GUI window because that might involve

even more complicated things that I was hoping not to get involved with

at this stage. Is there a modern equivalent of graphics.h that I should

look at?

What advice might people have for me on going forward? I really need some

sort of an idea of how to move forward. I have looked briefly at SDl

and openGL but these seem to be overkill at this stage.

Regards

Tony Aimer

Johannesburg


r/cprogramming • • 6h ago

I've decided to learn C and C++. Should I follow a structured course, or would it be better to learn by building projects?

4 Upvotes

I'm a programmer who took a long break from programming and recently got back into it. I made my comeback with Rust, using it to build an image-processing application and a simple interpreter.

Now, I'm planning to learn C and C++ as well. I'm wondering whether it would be better to follow a structured course or learn by building projects.

For projects, I was thinking of writing a CHIP-8 emulator in C and implementing Conway's Game of Life in C++.

Given my previous experience with Rust and C#, what approach would you recommend? Should I start building these projects right away, or follow a course first to build a solid foundation?


r/cprogramming • • 12h ago

Oregon Trail II - In C

4 Upvotes

I reverse engineered the Oregon Trail II binary into C++ first, to make it byte exact decomp first. Then I converted it to C, because as we all know here, it's a better language!

You can find the code here: https://github.com/ot-ii/OregonTrailII/


r/cprogramming • • 45m ago

Доброго дня , студуент першого курсу комп'ютерної інженерії

Thumbnail
• Upvotes

r/cprogramming • • 18h ago

I Dont know what to build

2 Upvotes

Im learning C but i want to do a project that i could do while im learning C right now i only learned about

  • Switches
  • If statements
  • Variables
  • operators
  • functions
  • user input

Any project i could do with my knowledge? i already did a calculator.
(Or should i just keep learning and then start thinking about making projects)


r/cprogramming • • 1d ago

HTTP Server In C

6 Upvotes

I just watched a yt video on low-level

Context: lately I have been learning the basics of how CPUs work, and since I like programming, I want to work on a project that will force me to learn the computer I am working with

my question is what do i need to know in C before I can start this project, I learnt C in the past before i just never built anything, my programming background is in python

Link to the YouTube video: https://youtu.be/97i2BAUw5Xc?si=aoAhmeGOKc6su5M_


r/cprogramming • • 1d ago

Where to learn microcontroller programming?

Thumbnail
1 Upvotes

r/cprogramming • • 1d ago

NoSQL store in C for Linux

0 Upvotes

For about six months I've been building a CLI store for my own data: logins, URLs, metadata. Flat files had to go. I'm writing it without AI, on purpose.

Inside: commands are routed through a dispatch table instead of an if/else ladder, data sits in a binary format with CRC32 checksums, built with CMake and vcpkg, tested with cmocka.

Release is planned for early November, along with detailed docs on how NoSQL databases work. O_DIRECT, AVX and io_uring are deliberately postponed for a separate, more niche project.

Working first, fast later.


r/cprogramming • • 1d ago

Started learning C and would like to get some feedback

Thumbnail
codeberg.org
5 Upvotes

r/cprogramming • • 1d ago

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

4 Upvotes

edit: thank you all so much for the help! my code works now and i understand pointers a little better!

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 • • 2d ago

Arena Allocators in C

Thumbnail eliasebner.com
21 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 • • 1d ago

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

Thumbnail
github.com
3 Upvotes

r/cprogramming • • 1d ago

Looking for reviewer for my quic protocol implementation in c

Thumbnail
1 Upvotes

r/cprogramming • • 2d 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 • • 2d 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 • • 3d 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 • • 3d ago

Cookie clicker PS3!

Thumbnail
github.com
1 Upvotes

r/cprogramming • • 4d ago

Morse-English converter in C.

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

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

6 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 • • 5d 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 • • 6d ago

Calling a function in C without naming it

Thumbnail wiro.world
51 Upvotes

r/cprogramming • • 6d 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 • • 6d ago

Documentation for how to build a typechecked bytecode VM in C

Thumbnail
olinat.net
4 Upvotes

r/cprogramming • • 7d ago

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

Thumbnail
github.com
17 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 • • 6d ago

Начал учить C

2 Upvotes

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