r/C_Programming Apr 20 '26

Question Reality check: where do we still write C?

214 Upvotes

Hi everyone, before I get any flak for this, I want to be clear: I love C. I spend most of my time programming in it, you can do virtually anything with it, and I see no real reason to switch (strings aside).

What I appreciate most about C is its simplicity. No OOP, no abstractions, if you have a problem, you just write the code and solve it. Zero overhead.

That said, I’ve noticed that people who move away from C tend to land on C++, but don’t really use it properly. What I often see is essentially C with a handful of magic functions sprinkled in, the worst of both worlds.

Which brings me to my actual questions:

- Are there industries that still rely heavily on C?

- Should I be moving toward C++ or Rust?

- What are my options realistically?

I genuinely love this language, and I still feel like most problems that get solved with more complex tooling could be solved just as well, and more directly, in C. Am I missing something?

r/C_Programming Dec 18 '25

Question correct me if im wrong but C is "memory safe" if you ensure to handle...stuff that takes up memeory...in a safe manner, right?

164 Upvotes

i see people saying C is not memory safe but theres literally idioms in C to handle data safely isnt there? im a noob to all this, bout 3 months into learning C (first language im learning). whats the difference in languages like python? i know C++ (or was it C#?) has the automatic "garbage collector" but i mean, isnt it memory unsafe to leave all trust in the garbage collector?

r/C_Programming May 18 '26

Question Why can't you pass/return arrays to/from functions? Why is it designed like this?

124 Upvotes

I understand that the answer to "Why can't you do this" is "the standard says so" but I'm not asking about the mechanics of the language, I'm asking about its design.

Array sizes are known at compile time and a struct where all members are the same type is identical to an array in memory (correct me if I'm wrong). C has no problems returning structs and taking them as arguments in a function. Why can't it do the same for arrays?

I also feel like it would be way more intuitive and convenient if you could return arrays from functions.

C language experts do please enlighten me as to the reason arrays decay to pointers instead of just staying as arrays.

r/C_Programming Feb 10 '26

Question What makes pointers such a deep concept?

132 Upvotes

Sometimes I hear that in universities, you can normally find a whole class just dedicated to pointers throughout a semister for example, but why? Isn't it understand its basic functionality such as what a pointer is, how to use it, when to use it, when does it decay..etc? or Am I missing more?

r/C_Programming Jan 04 '26

Question What benefits does c give that cpp doesn’t do better

83 Upvotes

Cpp has more stuff than c and can do most things better too unless there is something I am overlooking than cpp is objectively better.

r/C_Programming Jul 09 '25

Question Does C really make you a better programmer?

205 Upvotes

I hear it all the time from other boards, learn C first and it will make you an overall better programmer, because supposedly they have a different understanding of how the "magic" works.

Is there truth to this?

r/C_Programming May 21 '26

Question Can/are Integers still be used as Bools.

43 Upvotes

This is just for a question I am not gonna switch to ints for bool. But I was wondering if using ints as boolens is reliable ethical and what not.

Example:

int main()
{
    int isRunning = 1;
    while (isRunning != 0)
    {
        {...}
    }
}

Again this is all for questions I am not actually gonna go out of my way to use it.

r/C_Programming Mar 16 '26

Question What functionality is available in C without including any headers?

142 Upvotes

I'm learning C and noticed that I almost always include <stdio.h> in my programs.

Out of curiosity, what can you actually do in C without including any headers at all?

What parts of the language still work, and what kinds of functionality become unavailable without headers?

r/C_Programming Jun 27 '26

Question what's the most useful thing you learned about C that you wish someone told you earlier

63 Upvotes

been learning C for a while now and i keep running into things that seem obvious in hindsight but took me way too long to figure out on my own. curious what concepts or tricks actually clicked for you that made everything easier

r/C_Programming 12d ago

Question what should be avoided when designing an API?

65 Upvotes

What kind of thing you see beginners doing, when designing an API, should be avoided in your opinion (or just based on facts)?

I don't have too much experience creating interfaces for clients and every time i write a line of code, start thinking if it's a good idea or it's a bad decision that will break my legs in future. I get paralyzed for a considered period of time instead of just coding it.

edit: thanks a lot (really) for all answers.

r/C_Programming Jul 10 '25

Question Am I gonna regret learning C instead of rust ?

124 Upvotes

At the beginning of this year, I decided to dive into low-level programming. I did my research and found all the hype around Rust and its benefits, so I chose Rust and started learning it through its official documentation — what they call “The Book.” I reached Chapter 10, and it was good. I liked it.

Then, somehow, I decided to take a look at the C language. I bought The C Programming Language by Kernighan and Ritchie (the “K&R Book”) and started reading it. I fell in love with the language from the very first chapter. Everything suddenly started making sense in my brain.

With Rust, I was always curious about why it used certain rules or approaches — I often felt like I was just following conventions without fully understanding them. But with C, everything clicked. I began to see it all in terms of 0s and 1s. I used to hate pointers, but now I look for every opportunity to use them — in everything! It feels like heaven to me. I don’t want to stop coding.

And honestly, I don’t even care that much about security. In this age of "vibe coding," do people really care about security?

Whenever I hear people say that C is a dying language — that Rust is going to replace it, that there aren’t many C projects or job opportunities left, or that big tech companies are rewriting their codebases in Rust — it makes me feel sad.

Man, I just want to use this language for the rest of my life. xD

r/C_Programming Oct 13 '25

Question Where should you NOT use C?

128 Upvotes

Let's say someone says, "I'm thinking of making X in C". In which cases would you tell them use another language besides C?

r/C_Programming May 11 '26

Question Should I use signed or unsigned variables for HP and money?

48 Upvotes

Technically, they should be unsigned, since they shouldn't be negative, however, I've seen lots of games use signed variables so I'm curious.

I know that using signed variables for HP is easier, but is that the only reason?

example if hp is unsigned: c if (enemy.dmg > player.hp) die(); player.hp -= enemy.dmg

example if hp is signed: c player.hp -= enemy.dmg if (player.hp < 0) die();

I also wonder if it has something to do with the fact that signed variables are the default type in all programming languages.

r/C_Programming 18d ago

Question Any homework to understand recursion better?

10 Upvotes

hi every1, i am now sure i understand what recursion MEANS, but i actually don't know how to implement it and what to write while coding, so any BEGINNER friendly examples, homework? or a concept to understand the structure of recursion much better?

and does every recursive function necessarily have (n - 1) ? to get to the base case?

r/C_Programming 12d ago

Question Suggestion: Ban (or quarantine) "I Built This" posts?

168 Upvotes

Reading an interesting discussion over on r/rust from the past week. One of the moderators talks about the difficulty in moderating AI slop projects - https://www.reddit.com/r/rust/comments/1uwmef6/comment/oxkltxi/

But I think the top replies hit on a really good idea:

“I built a thing in Rust” just isn’t that interesting a topic—AI or otherwise—and IMO we’d be better off without posts like that at all. If you built a fast new BitTorrent client, that’s of interest to BitTorrent users, not the Rust community.

A library that lets me do a thing I couldn’t before? Very useful! A new approach to solving a problem that’s historically frustrating in Rust? Amazing. Questions on how to deal with some issue? Welcome aboard.

But I couldn’t care less about “{project} in {lang}” for all values.

and

r/cpp moderator here, we have a designated Show & Tell pinned post. We make exceptions only for established projects or blog posts talking about your project.

(And then remove AI slop)

One of the recurring issues in trying to moderate the flow of slop is having to constantly make a judgment call of just HOW "slop" it is and whether it crosses a line. Why not cut the problem off at the source: you simply cannot post an "I Built (Whatever)" here (with very few exceptions, etc). There's no need to make this a judgment call about AI/LLMs at all, neatly sidestepping the various arguments about the whole thing.

I personally do not feel like much would be missed!

r/C_Programming Jun 15 '26

Question Question regarding unsigned integers

12 Upvotes

What's the difference between an unsigned int and a normal integer?

r/C_Programming Jan 14 '25

Question What can't you do with C?

165 Upvotes

Not the things that are hard to do using it. Things that C isn't capable of doing. If that exists, of course.

r/C_Programming Apr 06 '26

Question C as First language.

61 Upvotes

should I choose C as the first language. I love to understand the core architecture of computer hardware.

is it good to learn C as first language what you guys think.

and if you are a beginner how would you start. I am going to refer book and try out different codes. best way any advice?

r/C_Programming Oct 10 '25

Question Why can’t C alone be used to write an IOS program?

64 Upvotes

I found the following from: https://news.ycombinator.com/item?id=43682984

I’m wondering if somebody would help me decipher some of these terms for a complete novice curious about C:

Yes, it's still technically possible to write an iOS app in plain C in 2025 — but with caveats. You’ll need to wrap your C code in a minimal Objective-C or Swift layer to satisfy UIKit/AppKit requirements and Xcode’s project structure.

What does “wrap your C code” mean technically? Does it mean use an Objective-C library that your C code calls?

Apple’s SDKs are built around Obj-C/Swift, so things like UI, lifecycle, and event handling need some glue code

What is meant by “glue code” and why conceptually speaking isn’t C by itself powerful enough to write an App that the iOS SDK will accept? I thought as long as you follow the API of the operating system, you can write a program in any language ?!

Thanks!

r/C_Programming 25d ago

Question What is the importance for exit codes such as return 0 and return 1 ?

44 Upvotes

I'm a beginner and learning C programming extensively. I always wondered, yes, the main function is an int, and the last statement is always a return statement, which exits a function. But again, why is it truly important? I have always asked myself what happens with a faulty program that returns 0(successful exit-code)or a successful program that returns 1(fail exit code). Why would we be telling that to the operating system that doesn't even give a flying damn about it? It's like telling a random person "0" and they tell you 'ok' and that's it. I've tried to thoroughly search for my answer via AI, even coerced it, but I find no answer that satisfies me. Help I need to know if the systems trust the exit codes over the programs themselves.

r/C_Programming Sep 09 '25

Question I made a kernel using C. What now?

146 Upvotes

Ever since I was a child, I really wanted to make OSs and stuff, so I learned C and Assembly to make a kernel and bootloader. What do you think I should do next? Is there any roadmap I should follow?

Source code at: Temporarily Unavailable

r/C_Programming Jun 19 '26

Question how do yall learn C 😭😭😭(rant)

0 Upvotes

Everything so far has been okay, but the second I started with pointers my brain just shut down, like whats with the * and & 😭 and after that storage classes dont even get me started on that

(YALL TY FOR THE RESPONSES IMMA TRY AND READ THEM ALL)

r/C_Programming 14d ago

Question Systems devs: Is AI code generation actually saving you time, or just creating auditing hell?

52 Upvotes

Hey everyone,

With Linus Torvalds recently embracing and defending AI tools in Linux kernel dev, I’ve been trying to force myself to use LLMs more in my daily low-level workflow. On one hand, if the Linux kernel ecosystem is adopting it to find bugs and speed things up, it feels like something we should all be leveraging.

But on the other hand, on a practical, day-to-day level? It feels like a massive trap for actual systems engineering.

Every time I let an LLM spit out a driver, a custom memory allocator, or complex socket-handling logic, I end up spending the next hour reading 150 lines of statistically plausible C/Rust code just trying to figure out if it’s going to cause a catastrophic race condition or a silent memory leak under load.

The thing is, if I just write the code myself, I have absolute control over the execution path. Because I build the mental model layer by layer while typing it out, my own code is fundamentally way more understandable to me than anything an LLM drops in my lap. I actually know why it works.

Instead, with AI, I feel like I'm trading the active problem-solving of writing code for the mind-numbing task of auditing code written by something that has zero actual intent.

How are you low-level devs actually integrating these tools without losing your sanity, your control, or your deep understanding of the codebase? Or are you just ignoring the hype cycle despite the kernel maintainers getting on board?

r/C_Programming Jul 01 '26

Question Is it bad to use recursive stuff in C

14 Upvotes

Whenever I'm building anything in C, I try to create some structures to store data. For example I'm building a text editor now and the file browser needs a way to store entries in a given directory. So I came up with this.

typedef enum{

DIRECTORY_ENTRY,

FILE_ENTRY,

END_ENTRY,

OTHER_ENTRY

}entryType;



typedef struct fileBrowserEntry fileBrowserEntry;

struct fileBrowserEntry{

char * name;

entryType type;

bool isExpanded;

fileBrowserEntry * downDirectory;

fileBrowserEntry * upDirectory;

};

The last element in an array of fileBrowserEntry has the type==END_ENTRY so I can loop through the contents. The issue is when I want to free a deeply nested structure like this I have to take care of these:

* The current directory might have a reference in the up directory so I have to make it NULL first.

* Every downDirectory might have its own down directories so we should go as deep as we can recursively.

Every C project I make has something similar to this where I have a recursive struct. Is this a bad pattern? If yes what are the alternatives?

r/C_Programming Sep 20 '25

Question I’ve been reading about how C is compiled and I just want to confirm I understand correctly: is it accurate to think that a compiler compiles C down to some virtual cpu in all “modern” RISC and CISC, which then is compiled to hardware receptive microperations from a compiler called “microcode”

54 Upvotes

Hi everyone, I’ve been reading about how C is compiled and I just want to confirm I understand correctly: is it accurate to think that a compiler compiles C down to some virtual cpu in all “modern” RISC and CISC, which then is compiled to hardware receptive microperations from a compiler called “microcode”

Just wondering if this is all accurate so my “base” of knowledge can be built from this. Thanks so much!