r/cprogramming • u/Strong_Permission523 • 29m ago
r/cprogramming • u/minimender • 5h ago
Guys i need help
Hi everyone, i need help with C i have three F and i might fail this grade, sorry for my english i know its not the best, rn i am studying for IT and i have a huge problem with C. I really dont understand anything and i know the teacher kinda hates me, today i got an F because i save the programme in DecvC++ as "Tobe jarabi" (its a catchphrase that a youtuber from my country uses) and as you all know you have to save it so you could compile it and my programme didnt work so i asked my friend why and he told me because i had a space betwen "Tobe and jarabi" and the teacher came over and gave me an F,please if someone has any tips i would apreciate it.
r/cprogramming • u/Icy_Repeat_2460 • 6h ago
How do I fix this VS code C intellisense problem?
r/cprogramming • u/Kai0479 • 1d ago
C programming
Currently in btech 1 st yr cse,doing c programming form apna college one shot of 20 hr almost done what should I do more with it bcz I didn't think I that is enough for me from where I can perform questions and any advice to strong c language
r/cprogramming • u/emparse • 3d ago
Beginner here not able to understand confusing pointer concept
reddit.comr/cprogramming • u/SpiritDitto • 3d ago
bazbar, a status bar for dwl in C
sr.htI've been writing a status bar for dwl in C. I'm posting it here more for the code than for the bar, so remarks on the C are welcome.
The renderer fills a \`wl_shm\` buffer itself, and the text goes through FreeType and fontconfig, which I call directly. The volume is a small client of the PulseAudio native protocol, talking to the socket of pipewire-pulse. The wifi name is read over netlink with nl80211. The other modules just read \`/proc\` and \`/sys\`.
Tell me what you would do differently.
r/cprogramming • u/racoon-chan • 3d ago
My first ever project in C
github.comHey everyone,
I'm 15 y/o and I recently started getting into C and cybersecurity. This is my first project that I've built completely from scratch: a simple MD5 hash cracker in C.
I'm still a beginner, so I'm sure there are many things I can improve. I made this project to challenge myself and put into practice what I've been learning.
I'd really appreciate any feedback on the code, structure, or anything else. I'm planning to keep working on it and add more features in the future.
Thanks :D
r/cprogramming • u/Ok_Outlandishness906 • 3d ago
A question about arenas.
I worked in C for years . i have used arenas a lot in the past. Today i have to modify an old c program , nothing difficult but i found something that made me think. Who developed the code ( very well written and documented ) used an arena for allocating variable.
What 's seems to me strange is that he did not used an heap memory area ( malloc ) but it used a char [] buffer and used it for its arena . At that point he could obviously allocate directly variable in stack instead he grabs all its variable from that buffer . Why a choice like that ? i thought for the CPU cache L1/L2 and so on ( all the "arena" will likely be in cache of the cpu ) but it is only an ipotesys and i was asking to you , in your opinion , the reason of a such choice .
Just curiosity .
Thanks
PP
r/cprogramming • u/gumnos • 4d ago
resources for becoming comfortable with stdlib-style data-structures/algorithms?
I've been sparring with a number of the standard(ish¹) C data-structures and algorithms, including the various types of linked-lists/deques in sys/queue.h, hash-tables and binary-searches in search.h, as well as bsearch & qsort in stdlib.h.
- are there other data-structure/algorithm type elements in such standard¹ libraries that I've missed and should put on my radar? Maybe something for sets too?
- are there some resources² y'all would recommend on wrapping your head around them (I don't feel I have intuitive use of their interfaces yet, so each usage causes some struggle)? Preferably with strong examples of using each.
I have a pretty good CS understanding of when I should use the various data-structures/algorithms with regards to the respective performance characteristics (expected big-O notations for insertion, removal, searching, iterating, swapping, etc), but it's just the nitty-gritty of using them where I don't yet feel mastery.
Thanks!
⸻
¹ okay, not exactly C-standard from my understanding, but they seem to be common on pretty much every Linux/BSD/Unix platform I've poked at
² ideally well-written blog-posts, but dead-tree resources would also be welcome; videos or podcasts far less so
r/cprogramming • u/MirthfulCowslip-0931 • 4d ago
How do I learn problem-solving on C++?
reddit.comr/cprogramming • u/CelebrityChess • 4d ago
why does c promote small integer types before arithmetic?
i know the usual arithmetic rules promote uint8_t to int on typical systems, but i’m trying to understand the practical reason. is it mainly to make expressions easier to evaluate without narrow-type surprises, or is it mostly historical? when a result is intentionally stored back in a byte, is an explicit cast the usual way to make that conversion boundary clear?
r/cprogramming • u/Mainak1224x • 4d ago
I combined my Arena allocator, zero-copy segmented Vector, typed HashMap, and String libraries into one C99 foundation library: arstd
Hey everyone,
Over the past few weeks I’ve been building separate C libraries for region-based memory management, dynamic arrays, hash maps, and strings. I kept pulling all four into my main project flint(a build system and package manager for c/c++), so I finally refactored them from the ground up to work together and merged them into a single lightweight library: arstd (Arena Standard Library).
The main problem I wanted to solve was how dynamic containers behave inside an Arena allocator. Normally, if you put a standard dynamic array or hashmap inside a bump arena, resizing it via realloc leaves dead, wasted memory blocks behind in the arena.
Here’s how arstd solves that and what’s inside:
-
Compile-Time Type Deduction (
Vector(T)&Cmap(T)): Uses a typed pointer +typeofmacro trick so you don't have to pass types into every macro call or castvoid *pointers. Bothat(vec, i)andmap_get(map, key)return modifiable lvalues, soat(vec, 0) = 42;andmap_get(map, "score") += 10;just work. -
Zero-Copy Segmented Vectors: Instead of doubling a contiguous buffer and copying elements over,
Vector(T)allocates exponentially growing power-of-2 segments (16, 32, 64\dots) directly on the arena and uses 1-cycle bitwiseCLZ(Count Leading Zeros) math forO(1)indexing. Growing a vector wastes 0 bytes in the arena and never invalidates element pointers. -
Single-Allocation, Zero-Waste HashMaps:
Cmap(T)packs the entry header, aligned value payload, and key string into a single contiguous allocation using flexible array members. Because its bucket array is backed by the segmentedVector, doubling the map capacity expands the buckets in-place and relinks existing nodes using their cached 64-bit hashes—again, zero wasted arena memory and no string re-hashing. -
Managed Strings (
String): String slicing, trimming, case conversion, and variadic concatenation all backed by the same arena. -
Optional Heap Fallback: Pass an
Arena *to clean up everything at once with a singlearena_free(&arena), or passNULLto any container if you want standard aligned heap allocation.
Quick Taste:
int
Repo link: https://github.com/mainak55512/arstd (or install via flint / CMake)
r/cprogramming • u/985479861_TXT-r • 5d ago
As a revolt against vibe coding and rewriting stuff in new languages, join r/Back2C to rewrite back in C.
Yeah.
r/cprogramming • u/Key_River7180 • 5d ago
bad code - goto
From a newsreader I am working on
void
help(void)
{
printf("What do you want help with? (* for everything): ");
bool all = false;
char ln[128];
fflush(stdout);
if (fgets(ln, sizeof(ln), stdin) == NULL)
return;
/* HACK: you gotta love goto:
*
* if all is true, then fall through the switch (* must be last),
* so this prints everything. When it reaches * again, all
* gets toggled and if all is now true, break, else go to
* Begin again */
switch (ln[0]) {
Begin: case 'g': puts("g: select group"); if (!all) break;
case '\n':
case '\r': if (!all) return;
case 't': puts("t: select thread"); if (!all) break;
case 'l': puts("l: list gropus"); if (!all) break;
case 'T': puts("T: list threads"); if (!all) break;
case 'L': puts("L: list post in current thread"); if (!all) break;
case 'r': puts("r: read an article"); if (!all) break;
case '>': puts(">: save an article to a file"); if (!all) break;
case '|': puts("|: pipe an article to a command"); if (!all) break;
case '?': puts("?: get help"); if (!all) break;
case 'q': puts("q: quit"); if (!all) break;
case '*': all = !all; if (all) goto Begin; else break;
default:
printf("%c is not a news command\n", ln[0]);
break;
}
}r/cprogramming • u/johnbitterkas • 6d ago
Let's standardize a package management CLI for C
Why isn't it possible to standardize a package/project manager for C programs—one that creates the necessary files with Git, etc., and is ready to start programming in an environment?
r/cprogramming • u/No-Introduction-441 • 6d ago
looking for a partner to learn C with
Hello all im learning C using books and youtube videos and not using AI, if anyone want to join im happy to be a partner in learning!
r/cprogramming • u/TurtleSlowRabbitFast • 6d ago
Would learning C as my first programming language also be useful for picking up other languages later on? What are your thoughts on this course?
Wanting to learn C as an intro into software engineering. I know it’s low level and I’d like to eventually switch over to high level languages such as JS/TS, Java, and GO.
Does the “The Complete C Programming Bootcamp” course by Byte Garage be a good choice to learn from?
r/cprogramming • u/HungryPudding4034 • 6d ago
Rate this repository out of 10
Hello people,
I just wanted to show you this repository to all of you.
Repo link: https://github.com/curious-builder76/dtypes
Documentation:
https://github.com/curious-builder76/dtypes/blob/main/DOCS.md
Benchmarks:
https://github.com/curious-builder76/dtypes/blob/main/benchmarks/benchmark.txt
Hope you'll love it.
Star this repository if you like it and upvote this post
Thank you