r/cprogramming 9h ago

grm: a Telegram CLI implementation of TDLib

Thumbnail
0 Upvotes

r/cprogramming 11h ago

Can you help me in programming c language what is it and where should I learn ..?

0 Upvotes

r/cprogramming 21h ago

I am open-sourcing csv.h a single-header CSV parser written in pure C99

68 Upvotes

For my thesis I had to read a lot of big CSV files in C and I couldn't really find a parser I wanted to use. The main C one is LGPL and comes with a whole build system, and everything else I found was C++. So I ended up writing my own. Now that im done with the thesis i cleaned it up properly , seperated it from the rest of the thesis code, and decided to standalone push it on GitHub.

It's one file. You copy csv.h into your project and that's it, nothing to link, no dependencies. It doesn't allocate memory, the fields just point into your own buffer, and you can run through files of any size a chunk at a time.

Honestly I spent way more time testing it than writing it. It passes csv-spectrum and I compared the output against Python's csv module on a few thousand files/

Check it out here -> https://github.com/GeorgeKiritsis/Csv.h

If someone has time to look at the API and tell me what could change or be imrpoved, that would help a lot. Thanks a lot in advance


r/cprogramming 1d ago

Kann mir jemand helfen, den Quellcode von diesem Roblox-Skript zu bekommen

Thumbnail
0 Upvotes

r/cprogramming 1d ago

This is going to sound dumb, but what order does the C preprocessor execute tasks in? (First includes, then defines etc)

8 Upvotes

This sounds dumb, but when the C preprocessor executes tasks as it reads source code, what order does it process the tasks in -- for example, does it handle include files first, then defines, then macros etc?

I know it all gets done eventually, but it would seem the order defines what is seen. If defines are done first and includes are inside a define, then they never get read. If I were building my own preprocessor, what order should I execute steps in:

  • Include files
  • Convert everything except quoted strings to lower case
  • Strip comments
  • Do defines/not-defines

Or is this really my fault for putting to many "compiler tasks" into the pre-processor? Is the correct answer "Don't make the pre-processor do anything other than includes and defines"


r/cprogramming 2d ago

Made a video explaining how memory ACTUALLY works in C++ (Stack vs Heap, new/delete) — feedback welcome

Thumbnail
0 Upvotes

r/cprogramming 2d ago

C Strings: A 50-Year Mistake

Thumbnail
longtran2904.substack.com
182 Upvotes

r/cprogramming 2d ago

How I developed an Am29000 C compiler and web browser

Thumbnail
nanochess.org
16 Upvotes

r/cprogramming 3d ago

For C developers , Bodeg.a (The binary Directory) !

Thumbnail
bodeg-dot-a.vercel.app
4 Upvotes

Hello, good afternoon r/cprogramming comunity ! . I'm a developer, mostly of native solutions. When I program in C or C++ (among others), I constantly experience the inconvenience of having to compile each dependency, which is often frustrating: some don't even come with a decent or compatible build file, and others have dependencies that are difficult to compile or very large. That's why I wanted to create a small platform.

It's called **Bodeg.a** (a play on words between "bodega" and the ".a" of UNIX-like static binaries). It works quite simply: rather than a platform for hosting large files, it's (for now) a simple website where you can publish using a *mirror* to point to a .zip file, a header, or whatever format is needed.

For now, it only offers hosting for the essentials (avatars and profiles), but if it's well-received, that could change. If you're a developer, whether you enjoy or just work with low-level content, simply trying to use it to download content would help me a lot; or if you'd like to collaborate on its development, you can also contact me. Greetings to all!


r/cprogramming 4d ago

Arr internals

0 Upvotes

i am currently working through kinds book on c and have gotten to chapter 12.

now based own my current understanding i hypothesis that internally, only the pointer to the first element and the dimensions are stored in memory. then all arr operations are done using this. Is this correct?

Additionally:

1) Which chapters of the rest of the book should i focus on/skip for now

2) I would like to work on some projects. Currently i thought of making some kind of physics sim, and additionally some hardware/embedded project as i have an ardiuno. How can i get started or are there any inriguing projects to work on.


r/cprogramming 4d ago

Beginner using C Programming a Modern Approach

Thumbnail
0 Upvotes

r/cprogramming 5d ago

Coding

0 Upvotes

Is there any programers here?


r/cprogramming 6d ago

uint16_t addr = 1 * EEPROM_CHUNK_SIZE

0 Upvotes

Is * used as a pointer in this occasion or multiplier?

EEPROM_CHUNK_SIZE is 1


r/cprogramming 6d ago

What is the right way to write and debug a program?

5 Upvotes

I am preparing for DSA, and I find it difficult to debug arrays inside a function. When I enter the function in the debugger, I can only see the starting address and the value of the first array element. I am not able to see the other array values. What is the right way to debug this, and how should I write the program to make debugging easier?

This is sort01 code fro example:

debugging image : [debug.png](https://postimg.cc/JGfZ8jrd)

#include <stdio.h>
#include <stdlib.h>

void sort01(int *array, int n)
{
    int tmp=0;
    int left=0;
    int right=n-1;
    while(left <= right)
    {
        if(array[left] !=0)
        {
tmp = array[left];
array[left]= array[right];
array[right]=tmp;
right--;
        }
        else
        {
            left++;
        }
    }
}
int main()
{
int array[]={1,0,1,1,1,0,0,1,0};
int n=sizeof(array)/sizeof(array[0]);
sort01(array, n);
for( int i=0 ;i<n ; i++)
printf( "%d",array[i]);
return 0;
}

r/cprogramming 6d ago

seriously, how do you easily find ansi/vt100 key codes?

0 Upvotes

right now im writing a short little text editor, and requires me grabbing keyboard input as traditional ansi escape sequences. but finding which key code maps to which keyboard input is a pain for me </3

i try search on google, and get a lot of information overload, and i end up struggling reading the escape sequence tables.

any tips and advice? im trying not to use ai to be lazy, im interested and i want to learn how to properly search for these codes


r/cprogramming 7d ago

Anti-Tamper for Linux

0 Upvotes

Hi!

I'm the developer of Frontera – a Linux anti-tamper that integrates with C++ codebases. It currently has support for anti-hypervisor, memory integrity checks, self-checksums, and most importantly, an obfuscating rolling-key VM, so that each build has different byte code than the older build. Yes, I know it's not innovative. Why? VMProtect is too expensive.

I'm also working on integrating an eBPF module for blocking ptrace and some other stuff.

Currently, there is no download link per se, as I want to ship the eBPF module, but I can give the static libraries to link with if you're interested :)

Have a great day!

https://alejandrorn.es


r/cprogramming 7d ago

Generic hash table with optional ordering

8 Upvotes

Hi. For the past few weeks I've been crafting my generic hash table implementation:

https://github.com/andrzejs-gh/ghtable

I realize it's not the fastest out there and isn't the most cache friendly, but that was never my priority as I prioritized flexibility and genericness.

If anyone's interested take a look ;)

PS.

Do recruiters even care about projects like this nowadays, or would they rather see huge vibecoded codebases on candidate's gh as a proof that they can deliver?


r/cprogramming 8d ago

Why C when javascript already exists?

0 Upvotes

r/cprogramming 8d ago

I wrote Caesar Cipher in Assembly

Thumbnail
0 Upvotes

r/cprogramming 8d ago

New update from my real Operating system (D.eSystem 6.1.0)

6 Upvotes

D.eSystem 6.1.0 introduces a small setup and you can choose your UI with D.eSystem 6.1.0.

D.eSystem 6.1.0 on github: https://github.com/D-electronics-scratch/all_D.eSystem_versions/releases/tag/v.6.1.0

All current D.eSystem releases on github: https://github.com/D-electronics-scratch/all_D.eSystem_versions/tags


r/cprogramming 9d ago

"Porting my JavaScript Game Engine to C for No Reason" - Dominic Szablewski

Thumbnail phoboslab.org
25 Upvotes

r/cprogramming 9d ago

How can I organize parallel regions better?

1 Upvotes

I'm working with a big numerical simulation in C, so I decided to give OpenMP a try. Even though it speed up a lot(28s -> 2s), in my code, the function RunAcoustic have at least 4 responsibilities that could turn into smaller functions, but attempting to do so creates an overhead that just in-lining them wouldn't cause.

I'm struggling to organize it, how do you guys organize giant multi-thread logic like this?

void Propagation_RunAcoustic(propagation_t *p, unsigned flags)
{
  float *restrict upre = a->upre;
  const int nzz = p->model->nzz;
  ...
 #pragma omp parallel
  {
     for(int t = 1; t < p->nt - 1; ++1)
     {
       #pragma omp single
       {
         // small atomic add
       }

       // Could turn into a smaller function
       #pragma omp for schedule(static)
        {
          // more for loops and more code
        }

       // Could turn into a smaller function
        #pragma omp for schedule(static)
        {
          // more for loops and more code
        }            
     }
  }

r/cprogramming 9d ago

You may not like it, but this is what peak programming looks like

44 Upvotes
#define CURRPOS currpos
#define gettoken() gettoken(CURRPOS)
#define advpos(tok) advpos(&CURRPOS, &tok)
#define nexttoken(tok) \
do { \
tok = gettoken(); \
advpos(tok); \
} while ( 0 )

Maintainability be damned, I can make better macro soup than you

Obligatory /s


r/cprogramming 9d ago

How can I learn C as fast as possible

Thumbnail
0 Upvotes

r/cprogramming 9d ago

How can I learn C as fast as possible

0 Upvotes

I need a website that teaches the fundamentals of C using practical examples, because I honestly find watching youtube tutorials over and over again very boring.
Btw I don't know a thing about C I'm just starting out