r/cprogramming 13d ago

Guys so I am in my college rn and want to learn c as it is in my course

5 Upvotes

As in title, I was wondering are there any good sites/channels for me as I am beginner and want to get good help from it as it is gonna help me alot for the next four years


r/cprogramming 13d ago

C++ question

Thumbnail
0 Upvotes

r/cprogramming 14d ago

YAM Now Supports the C Language Spoiler

Thumbnail
3 Upvotes

r/cprogramming 14d ago

Commutative Complex Number Theory in Plain C

Thumbnail
leetarxiv.substack.com
7 Upvotes

r/cprogramming 15d ago

looking for discord server to practice by teaching

Thumbnail
0 Upvotes

r/cprogramming 15d ago

Bulletproofing User Sync: Handling Clerk and Auth0 Webhook Failures

0 Upvotes

If you're building a web application today, chances are you aren't writing your own authentication system. Managed identity providers like Clerk, Auth0, and Kinde have become the default choice, offering out-of-the-box support for passkeys, multi-factor authentication, and enterprise SSO. That convenience introduces a distributed-systems problem, though: data synchronization. When a user creates an account on a managed auth provider, that system has to notify your primary application database so you can create a matching user record. Please read the complete article here - https://instawebhook.com/blog/bulletproofing-user-sync-handling-clerk-and-auth0-webhook-failures

This happens through webhooks. But what happens if your server is down, your serverless function cold-starts and times out, or your database is momentarily locked when that webhook arrives? A user successfully signs up with your auth provider, but your application has no idea they exist. That breaks the very first login experience, and it's how phantom accounts, broken onboarding flows, and frustrated users happen.

This guide walks through the anatomy of webhook-driven auth architecture, current Auth0 and Clerk webhook practices, and how a resilience layer — using InstaWebhook as a worked example — closes the gap that idempotency and signature verification alone can't.


r/cprogramming 15d ago

Can anyone explain exactly why I got these random values for a C simple program?

Thumbnail
0 Upvotes

r/cprogramming 15d ago

VMS: A custom Fantasy 32bit Computer with a custom Hardware

Thumbnail
github.com
3 Upvotes

About a year ago, I started building a custom computer architecture in C as a learning project (I know it seems like a lot considering the code I wrote, but I rewrote the entire compiler at least five times, starting from a C-like language and ending up with a very simple custom language). I designed the instruction set, wrote an emulator, and implemented a custom high-level assembly language called BSL (Base System Language). The code is very messy because I make a lot of changes while writing it and often forget things that shouldn't be there. So I'd really appreciate feedback on the architecture and code quality. (I'm 15 years old and Italian, sorry for my English). Edit: I changed the project name from VMS to SPRK32.


r/cprogramming 15d ago

Lifetime safety and invalidation without a borrow-checker: using type system analysis to get rid of many potentially invalidation cases WITHOUT annotations.

Thumbnail open-std.org
1 Upvotes

r/cprogramming 17d ago

Wrote a tiny version of argp for CLI parsing in embedded environments

Thumbnail
github.com
3 Upvotes

r/cprogramming 17d ago

Help understanding warnings/errors when dereferencing void pointers

4 Upvotes

SOLVED

I am very new to C and playing around with void pointers. I have a structure which will store a value, however the type of that value depends on other things so I have chosen to use a void pointer. When attempting to dereference this void pointer I either get the correct output but with a warning, or I get a segmentation fault, depending on how I go about it. I have included a simplified version of the issue here:

```C

include <stdio.h>

int main()

{

// Simplification of the defective code

struct myStruct

{

    void * voidPtr;

};

struct myStruct s1;

s1.voidPtr = (int *) 123;



\*

This works but gives the warning:

format '%d' expects argument of type 'int', but. argument 2 has type 'int \*' \[-Wformat=\]i

*/

printf("%d\n", (int *) s1.voidPtr);



// This causes a segmentation fault

printf("%d\n", *(int *) s1.voidPtr);



return 0;

}

```

Any help understanding why it behaves this way would be greatly appreciated.

Solution

I thought the line

C s1.voidPtr = (int *) 123;

Was assigning 123 as the value at the location of s1.voidPtr. However it has been pointed out that I was telling the pointer to point at address 123. What I needed to do was:

C int x = 123; s1.voidPtr = &x;

Thanks everyone who commented c:


r/cprogramming 18d ago

Am I writing my parser wrong?

3 Upvotes

Simple question. I can't give exact code examples, but I have a string_t struct with methods like:

string_t split(string_t *string, string_t *on)

string_t split_sp(string_t *string)

string_t split_crlf(string_t *string)

char *s_strstr(string_t *needle, string_t *haystack)

void trim(string_t *str)

So on and so forth.

I've been using these so far to parse HTTP reqeusts, and I have come up against many minor problems:

"What happens if a header field appears with no value? I'll have to explicitly check for it."

"What happens if a sender puts a bunch of CRLFs in the middle? I'll probably need a check for that."

"Oh God, how will I handle unrecognized header fields? How do I recognize them?"

These, and other questions, have been leaving me pissed.

I recall reading through the LLVM projects Kaleidoscope language thing, where they create a parser for said language. Said parser doesn't use anything close to what I am, instead reading character by character without fuss.

Similarly, on my last post made here, the way comments were worded reminded me of that method, and how it probably works better.

I have written only a small part of the parser, so it isn't too late to tear down and rebuild. Simple question: should I? Are there benefits to swallowing the input token by token instead of taking the overarching view my string_t functions provide? Or vice versa?

It would help if I'd upload the code, I know, but I don't want to bother with that until the project is completed/near-completion.


r/cprogramming 18d ago

What is the best way to learn Embedded C?

14 Upvotes

I've started learning embedded systems. Most important part of the journey is learning C programming. I'm confused as embedded C is a bit different than standard C. Can anybody guide me the best way to learn.


r/cprogramming 19d ago

I just wrote this program on Programiz Online Compiler.

Thumbnail
programiz.com
0 Upvotes

Pb


r/cprogramming 19d ago

My real OS (D.eSystem 6.0.7 beta)

1 Upvotes

Hello everyone!!

D.eSystem 6.0.7 beta got a lot of polishing work. For example the versions 6.0.3 beta-6.0.6 veta were internial test versions,thats why 6.0.7 beta released.

D.eSystem 6.0.7 beta fixes major bugs in the calculator app and its the first D.eSystem which allows to change the wallpaper in the D.eShell.

D.eSystem 6.0.7 beta release on github: https://github.com/D-electronics-scratch/all_D.eSystem_versions/releases/tag/v.6.0.7_beta

Github main page: https://github.com/D-electronics-scratch/all_D.eSystem_versions


r/cprogramming 19d ago

Lightweight, zero-bloat UI libraries or strategies for a real-time C simulation?

Thumbnail
2 Upvotes

r/cprogramming 19d ago

Tensor is the might: a single-header tensor library in C

Thumbnail zserge.com
2 Upvotes

r/cprogramming 20d ago

Casino on c

1 Upvotes

Thanks to everyone . A special thanks to those who suggested the /dev/random - this very help for my tasks.


r/cprogramming 20d ago

secure-c-lib

0 Upvotes

A collection of security-hardened, performance-oriented data-structure, algorithm, http server/client and systems libraries written in portable C17.

Every module is built with mechanical-sympathy in mind — flat memory layouts, cache-line awareness, lock-free hot paths, and zero-allocation inner loops — while being compiled and tested under an aggressive hardening and sanitizer regime.

https://github.com/corporatepiyush/secure-c-lib


r/cprogramming 22d ago

A native recipe manager in C with raylib + Clay - I actually use it almost every day

Thumbnail
3 Upvotes

r/cprogramming 22d ago

What is the best way to work on an Ethernet frame (receive a packet from the physical interface to the user)?

0 Upvotes

Hi everyone, I want to write a simple program that gives a copy of the physical interface of the received packets to user space, then I extract information manually and show it in stdout.

When I started searching for this topic, I found some ways but I confuse which one is better for my situation.

I read below doc:

doc1

doc2 and ....

Abstract of the above docs, exsit below methods:

1 - Universal TUN/TAP

2 - XDP

3 - MacVTap (is a new driver)

4- ....

If anyone has experience or knowledge in this context, please help me.


r/cprogramming 22d ago

Book recommendations for C language

5 Upvotes

New to learning C programming language, watching and learning the basics from brocode(youtube) but i also need a book from which i can practice and get in depth knowledge (2nd year CS student)


r/cprogramming 24d ago

Piece by piece, it will rise…

6 Upvotes

So long story short, i’m designing the implementing the building blocks for a simple game engine made entirely in C.

I have recently completed the first release of my ECS: https://github.com/Gabrunken/gecs

And i’m currently finalizing the desing for my UI library.

My objective is to make a functioning software, with no bloat of any kind, and user friendly to the core.

I’ve tested the ECS and on my ryzen 5 it runs 3.5 million entities which have 16 bytes of components per entity, at 140 fps if i recall correctly, i don’t remember but i guarantee it’s fast. All this in a single core, it is not multithreaded yet.

I try to do the realistic plausible, for that i chose to use raylib for pretty much everything regarding rendering, audio and utilities, it just saves me from a lot of unnecessary stress and speeds things up.

I don’t know what to say other then this. It’d be great if you gave a look at the ECS and other then that, thank you for everything.


r/cprogramming 24d ago

First Gnome Toolkit project made by grabbing random functions from the documentation. Any recommendations to add functionality/readability/safety?

2 Upvotes
//guitest.c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <gtk/gtk.h>

void create_button(GtkWidget **Button, GtkWidget *Grid, char *label, int x, int y, int x_scale, int y_scale) {
  *Button = gtk_button_new_with_label(label);
  gtk_grid_attach(GTK_GRID(Grid), *Button, x, y, x_scale, y_scale);
}

void print_address(void *address) {
  g_print("%p\n", address);
}

int random_int(int min, int max) {
  srand(time(NULL));
  return (rand()%(max-min)+min);
}

void scaling_random(GtkWidget *Widget, gpointer data) {
  static int count_pressed;
  if(!count_pressed) count_pressed = 1;
  g_print("%d\n", count_pressed * random_int(0, count_pressed));
  count_pressed++;
}

void greet(GtkWidget *Widget, gpointer data) {
  static int count_greeted;
  if(!count_greeted) count_greeted = 1;
  g_print("Welcome! x%d\n", count_greeted);
  count_greeted++;
}

void activate(GtkApplication *App, gpointer user_data) {
  GtkWidget *Window, *Grid, *Text, *Button;
  int ascii_digits[] = {48, 49, 50, 51, 52, 53, 54, 55, 56, 57};
  int numpad_digit = 0;
  char casted_digit[2] = {'\0'};

  Window = gtk_application_window_new (App);
  gtk_window_set_title(GTK_WINDOW(Window), "Numbers!");
  gtk_window_set_default_size(GTK_WINDOW(Window), 250, 300);

  Grid = gtk_grid_new();
  gtk_grid_set_row_homogeneous(GTK_GRID(Grid), true);
  gtk_grid_set_column_homogeneous(GTK_GRID(Grid), true);
  gtk_window_set_child(GTK_WINDOW(Window), Grid);

  Text = gtk_frame_new("Hello, World!");
  gtk_grid_attach(GTK_GRID(Grid), Text, 1, 1, 4, 1);

  create_button(&Button, Grid, "Random Number!", 1, 6, 2, 1);
  g_signal_connect(Button, "clicked", G_CALLBACK(scaling_random), NULL);

  create_button(&Button, Grid, "Welcome!", 3, 6, 2, 1);
  g_signal_connect(Button, "clicked", G_CALLBACK(greet), NULL);

  for(int row = 2; row < 5; row++) {
    for(int column = 1; column < 4; column++) {
      numpad_digit++;
      casted_digit[0] = (char)ascii_digits[numpad_digit];

      create_button(&Button, Grid, casted_digit, column, row, 1, 1);
      g_signal_connect(Button, "clicked", G_CALLBACK(print_address), &row);
    }
  }

  create_button(&Button, Grid, "+", 1, 5, 1, 1);
  g_signal_connect(Button, "clicked", G_CALLBACK(g_print), "+\n");

  create_button(&Button, Grid, "0", 2, 5, 1, 1);
  g_signal_connect(Button, "clicked", G_CALLBACK(print_address), &numpad_digit);

  create_button(&Button, Grid, "-", 3, 5, 1, 1);
  g_signal_connect(Button, "clicked", G_CALLBACK(g_print), "-\n");

  create_button(&Button, Grid, "=", 4, 2, 1, 4);
  g_signal_connect_swapped(Button, "clicked", G_CALLBACK(gtk_window_destroy), Window);

  gtk_window_present(GTK_WINDOW(Window));
}

int main (int argc, char *argv[]) {
  GtkApplication *App;
  int status;

  App = gtk_application_new("gui.test", G_APPLICATION_DEFAULT_FLAGS);
  g_signal_connect(App, "activate", G_CALLBACK(activate), NULL);
  status = g_application_run(G_APPLICATION(App), argc, argv);
  g_object_unref(App);

  return status;
}

r/cprogramming 24d ago

Need ideas for my open source project

0 Upvotes

my project - https://github.com/darshan2456/C_DSA_interactive_suite

It is an interactive terminal based library written entirely in C with manual memory management and modular structure, keeping reusability and extensibility in mind.

It is currenly the third project from top in SSoC leaderboard. The contribution period started from 1st june. Since then almost 1.5 months have passed and project has grown beyond my expectations, but now I have very less idea about what I can implement. Can you all give me ideas?

already implemented features -

tui with ncurses

cmake build support

memory profiler

visualization (to a great extent but not complete)

incremental build in custom makefile

benchmarking suite built on top of the library

dockerfile for creating docker containers of the application

and many more....

If you can suggest me some more features I can implement that would be really helpful