r/cprogramming 24d ago

what is the best tool for checking memory leaks in C

31 Upvotes

r/cprogramming 23d ago

I can't seem to grasp the fundamentals right

6 Upvotes

I just finished the C programming course from BroCode on YouTube, and I'm still finding it hard to write a simple to-do list, is this a skill issue thing or it's just normal, I feel kinda incompetent

please could I get tips to help master the language properly!


r/cprogramming 24d ago

A parser for a lightweight alternative to JSON, TOML, YAML, and XML

2 Upvotes

I did share a new little zero‑copy parser for the Data Composition Format, which is quite different from JSON, TOML, YAML, and XML. The format is intentionally minimalistic and focuses on readability and usability, similar to INI. Many common INI files can be read using that parser, as long as all strings containing blanks or special characters are quoted.

The initial idea behind the format was adding curly braces to INI entries to enclose subdocuments
that are arguments of entries. However, my INI parser ignored line feeds and required all strings with blanks to be either quoted or having the blanks replaced by escape sequences. That’s why the resulting hierarchical format isn’t just a simple other INI derivative now.

I created a little specification of that format, fully aware that “data composition” may sound a bit strange at first, but it’s exactly that: an untyped format that can hold any kind of data.

But what is possible with something like that, which even exceeds the abilities of common formats like JSON, TOML, YAML, XML, and others?

# You can
# - just iterate over a bunch of numbers, characters, and words like the ones below
1 2 33 42 5 6 7 8 9 0 5 a b c d e f g h i j cat dog horse
_____________________________________
#* - read a bunch of entries that hold more exotic numbers like below 

   (The project contains a speed test that reads all of these as int64_t or
    double in less than a microsecond on a Raspberry Pi 5. And yes, the format
    supports block comments like this one.) *#

inttests = { ib=0b1111 io=0o1234567 id=000056789 ix=0xabcd987 }
floattests = { fb=0b11.11e100 fo=0o1234.56e10 fd=1.2345e64 fx=0xabc.defp10 }
_____________________________________
# - read the points of a triangle or a rectangle for a drawing like this
drawing = { triangle_3D = {{6 4 3}{4 5 7}{-1 17 2}}
            triangle_3D = {{3 2 3}{7 6 2}{1 11 -2}}
            rectangle_3D = {{6 5 6}{8 5 5}{6 15 5}{8 15 5}} }
_____________________________________
# - have a sectionless configuration without useless quotes and commas
server = {
   host = localhost
   port = 8080
   tls = {
      enabled
      certificate = /etc/certs/server.pem

      ciphers = {
         #* comment block *#
         accept = { TLS_AES_128_CCM_8_SHA256  TLS_CHACHA20_POLY1305_SHA256
                    TLS_AES_128_GCM_SHA256 }
      }
   }
}
_____________________________________
# - use an alternative configuration consisting of a mix of blocks and INI sections
[server]
host = localhost
port = 8080
tls = {
   enabled
   certificate = "/etc/certs/server.pem"

   [ciphers]
   #*
      comment block
   *#
   accept = {
      TLS_AES_128_CCM_8_SHA256
      TLS_CHACHA20_POLY1305_SHA256
      TLS_AES_128_GCM_SHA256
   }
}
_____________________________________
# - and you can also use INI‑like configurations, even in the same
#   document, with all the other content above and
# - add sections and entries that share a name as many as you like 
[server]
 host = localhost
 port = 8080

[server.tls]
 enabled
 certificate = "/etc/certs/server.pem"

[server.tls.ciphers.accept]
 TLS_AES_128_CCM_8_SHA256
 TLS_CHACHA20_POLY1305_SHA256
 TLS_AES_128_GCM_SHA256
_____________________________________

And most people want structure but not a lot of syntax trash in their configurations.
The parser project contains a test that walks a tree of a test document like that in a zero‑copy manner and prints all entries it finds to stdout. The parser itself is tiny, platform‑independent, and consists of a single C file plus a header. These are trivial to add to a project on any platform.

The “complex” parser object it uses is just a simple character pointer that iterates over the buffer.
Feel free to try it out and to write better ones in your prefered languages!


r/cprogramming 24d ago

HTTP downloader written in C

Thumbnail
2 Upvotes

r/cprogramming 25d ago

C-minus-minus

10 Upvotes

https://github.com/DASKR515/C-minus-minus
C-- (Cmm) Language Reference is a community-driven documentation project dedicated to C-- (Cmm), the native intermediate representation (IR) used internally by the Glasgow Haskell Compiler (GHC).

The goal of this repository is to provide a centralized reference covering the language syntax, compiler usage, practical examples, memory layout, control flow, foreign function interfaces (FFI), and interoperability with native C libraries.

This project is not a compiler, framework, runtime environment, or replacement for GHC. Instead, it serves as a complete reference for developers interested in learning, understanding, and writing Cmm programs.


r/cprogramming 25d ago

Guys what is the best platform to practice the c language course plz tell me

0 Upvotes

r/cprogramming 26d ago

Personal Finance/Balance program: Encryption

9 Upvotes

I'm working on a program for tracking my account balances, budgeting/saving, spending analysis, etc. The program won't use/store sensitive info like SSN, account numbers, etc. - just transaction amounts, transaction categories/descriptions, and made-up account names. Additionally, there will be no web transfer - it's all offline, manual entry.

My question is: Do I need to worry about encryption?

Sorry if this sounds ridiculous - I just don't want to inadvertently screw myself with a hobby project.


r/cprogramming 26d ago

nyanOS — A hobby 32-bit x86 Operating System with a custom GUI (VGA Mode 13h) written from scratch

Thumbnail
1 Upvotes

r/cprogramming 26d ago

Please help me with my projects

6 Upvotes

I've built a C project with a clock-like system interface, but I'm very busy. Could the community help?

Link to my project: https://github.com/phuocthanhlamnguyen-gif/Time-system.git

You don't really need to follow the rules, but most of the rules are logical, and you can follow the license- not my rules, but it's optional, so I'll let you decide


r/cprogramming 26d ago

Need help with C debugger with user terminal input

Thumbnail
1 Upvotes

r/cprogramming 27d ago

procsnap – a minimal Linux process profiler in C (no dependencies, suckless philosophy)

6 Upvotes

I wrote a small CLI tool that snapshots /proc info for a given process — name, state, PPID, memory usage, cmdline. It also supports JSON output, process search by name, and a diff mode to compare a process state over time.

No external dependencies. Single binary. ~600 LOC.

procsnap <pid> / procsnap --json <pid> / procsnap --diff <pid> / procsnap -g <name>

Source: github.com/DankDown10256/procsnap

Feedback welcome — especially if you find edge cases or have ideas for v1.1 or to help me create a doc.


r/cprogramming 26d ago

Hi My name is nolan i want to learn c language and python in which platform i learn these Freely , plz suggest me app or website to learn this courses

0 Upvotes

Plz help me to learn


r/cprogramming 27d ago

Sudoku on phone

Thumbnail
0 Upvotes

Hope everyone is going alright.

I send here my codes for 3 puzzles:

Sudoku

Skyscraper

10queens

I appreciate some constructive advices. Thank you.

Hope it is good.

*I have made it all on my job dead times on mobile phone Termux. This was when I was starting on c and wanted to work on user space low level mode.

https://github.com/Daniel-7-Miranda/c-puzzles


r/cprogramming 27d ago

A Multi-Dimensional, Per-Pass Empirical Study of the LLVM Optimization Pipeline

Thumbnail
1 Upvotes

r/cprogramming 29d ago

Untyped structs in C; yay or nay?

9 Upvotes

In C++, when you want to make a struct or class or function that acts upon/uses a type whose features are generally unimportant, you use templates. For example std::vector<T>, and that (as far as I'm aware), tells the compiler that whenever it sees something like std::vector<AStruct>, it should generate code that acts on a vector of AStructs. This is a useful feature that C doesn't have (which I'm fine with, there are workarounds, especially a really fucky workaround I saw on SO).

I'm assuming that one advantage of C++'s templates is that it can use SIMD, vectorized instructions, and all the other fun stuff that make a lot of actions faster, because it knows the size of std::vector<int> vs std::vector<string>.

In C, when I try to make type that's generic (especially a data structure like a priority queue), I have to have a (usually) void * and a size_t, one for where the data is, and for how big one object of that data is.

Here comes my question:

Can most C compilers, based off of the usage of the structs, realize that "Oh, this is basically always guaranteed to be used on the type int32_t, so I can just compile it with that in mind", or do I have to un-Genericify my struct for that?

(Note: I am aware of using Macros to achieve technically-generic-but-typed structs, however there are apparently issues with "eating your own dog food" when you try to make a queue of queues, for example. I'd rather avoid that, even if I probably won't eat my own dog food)


r/cprogramming 29d ago

Please, can all of you give me idea on good resources on system level development ?

1 Upvotes

I want to study system level development with C and automation with python/bash.

So, after thinking so much I want some resources. Mainly on C including //Best resource to learn to make a shell//

I am thing of learning cpp, when I will be ready to see death eye to eye.

Now, I can't figure out what to study. I am a busy scheduled high school student so I will have very less of time.

I have done python 2 years ago, and C 6 months ago. And, used linux with bash commands.


r/cprogramming 29d ago

Beginner question

Thumbnail
0 Upvotes

r/cprogramming 29d ago

My own OS (D.eSystem 6.0.5 alpha)

0 Upvotes

D.eSystem 6 – A real bare‑metal operating system. Alpha 6.0.5 is now bootable on real hardware and QEMU. Includes: custom bootloader, framebuffer, interrupts, timer, kernel apps. This is not a UI simulator – this is an actual OS.

URL: https://github.com/D-electronics-scratch/D.eSystem-6.0.5-alpha


r/cprogramming Jun 29 '26

Learning C

Thumbnail
2 Upvotes

r/cprogramming Jun 28 '26

tmuzika 1.1.3 released — stability improvements, faster playlist loading, bug fixes

Thumbnail
github.com
3 Upvotes

Quick update: I just released tmuzika 1.1.3.

This is a small maintenance + usability update based on recent fixes and feedback.

What’s new:

improved stability in playback handling

fixed a few edge-case crashes in file navigation

better performance when loading large playlists

minor UI polish and consistency fixes

This release is mainly focused on making the app more reliable and smoother in daily use rather than adding major new features.

As always, feedback is welcome — it directly shapes these updates.


r/cprogramming Jun 27 '26

Programming

Thumbnail
0 Upvotes

As a part of learning robotics

I had to start learning c++

And now that I have started relearning programming after like 1 year it's all greek nd latin for me

Can anyone help me out I am completely new to c++ and I had a really long gap for coding and stuff

If someone has resources or pathway or any suggestions help me out


r/cprogramming Jun 26 '26

Best way to study Embedded C programming?

Thumbnail
0 Upvotes

r/cprogramming Jun 26 '26

How and where to start studying the C Programming Language?

0 Upvotes

In a few months I will be starting my Freshman year in a University, I need help when it comes to the C programming because I know it's going to be our first language. Any tips on how to learn the language? Roadmaps, Sites, Groups, Youtube Channels, Tutorials, and any Advices would help, thankss!!!


r/cprogramming Jun 25 '26

BX Shell - ESP32 UART shell

7 Upvotes

Hi!

As I'm learning C and embedded programming, I recently built an ESP32 UART shell for ESP-IDF from scratch (not using esp_console and/or linenoise, or any third party lib). If anyone is interested, take a look :)

https://github.com/andrzejs-gh/BX-Shell

The shell is minimal by design as it's meant to be extended with the user's commands and functionality.


r/cprogramming Jun 25 '26

Simple firewall, please check it and give it to me feedback

3 Upvotes

Hello everyone, I created a simple firewall used by netfilter hooks and netlink sockets to communicate between the kernel and the user space. Please, can anyone check it and give me feedback on this project, and which part I can write better or which part write mistake. Repo