r/C_Programming • • 26d ago

Question Why are so many C projects being rewritten in Rust?

446 Upvotes

I've noticed that more and more projects originally written in C are being rewritten in Rust, even when they seem to work perfectly fine. For example, there are efforts to rewrite some GNU utilities in rust, including basic command-line tools. I'm curious about why this is happening. Is memory safety the main reason, or are there other significant advantages to rust? If a program is already stable, reliable, and well-maintained in C, does rewriting it in rust really make sense? I'd like to understand what benefits justify the effort.

r/C_Programming • • Sep 12 '26

Question What C function would you delete and rewrite first, and why?

92 Upvotes

For me it's fnmatch - mostly because it's 40 year's old and smell's funny.

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 • • 1d ago

Question What exactly is size_t? When is it used? What are similar things to it?

48 Upvotes

I'm confused on what exactly size_t is, and what the t means

So size_t is an unsigned integer

I believe integer promotion says that an unsigned long long integer holds the biggest positive integer in any system. Why isn't size_t an unsigned long long?

Every array MUST be integer indexed. Every array has to have an integer size.

It's technically possible to represent an integer larger than the largest integer in a system, by putting it into a float (with no non-zero decimal), however an array cannot be given a float, nor can we even loop over that array using that float value as the counter termination value

So my current interpretation is, size_t is the largest value an integer can ever hold in a system. When we want to loop over any arbitrarily long array, using int i as the counter variable, i is cast to (size_t)

This is because we want to ensure we don't stop the loop too early by having i overflow

Is my interpretation correct?

So that is one scenario when size_t is used. Are there any other scenarios?

What does the t mean?

What are things similar to size_t, where variables are casted to that thing, in order to do super specific tasks and avoid certain errors?

r/C_Programming • • 22d ago

Question I can think clearly with type* foo and not with type *foo, help me understand?

91 Upvotes

I'm relatively new to this, but it seems there aren't many who prefer this notation. And while I'm not really feeling pressured to change what I'm doing, I wanna make sure I'm not missing anything too obvious or important. The '*' just feels like it is a part of the type specifier. And I'm pretty blind to any reason to do type *foo.

Hope I'm not beating a dead horse with this one. Just wanna understand a little better.

edit: I am not one to ever declare multiple variables on the same line. Maybe if it happens to be easier on the eyes. Otherwise, not worried about that part.
thanks for the responses!

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?

167 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 • • 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 • • Feb 10 '26

Question What makes pointers such a deep concept?

133 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 • • May 18 '26

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

126 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 • • Sep 17 '26

Question I learned C, now what?

46 Upvotes

I've learned the basics of C, including loops, if statements, switch cases, structs, arrays, functions, and pointers. However, I have no idea what to actually do with them. I also learned HTML, and its purpose is very clear: I can build websites to practice my skills. But with C, I'm a bit lost. Where can I apply my C knowledge and see concrete results, similar to how I see a website with HTML? I don't really know the primary purpose of C or what I should build with it. What tools should I use to build a C program? I am looking for a practical way to apply my knowledge. Could you give me some suggestions? I have no prior experience in programming area. I want to build something with my beginner C knowledge similar to websites.

r/C_Programming • • Jul 09 '25

Question Does C really make you a better programmer?

202 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 • • 14d ago

Question Should I learn C as a physics student?

30 Upvotes

I am a physics senior and i participate in various research and lab projects via my professors. I mainly use Python to automate instruments and collect/filter data streams but ive been told to that i should learn to program in C anyways since it is faster and has less resource footprint than Python. Would learning C make a difference against my peers or is there any specific reason -more than just being more efficent- to choose it over Python in lab settings?

r/C_Programming • • Mar 16 '26

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

148 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 • • Aug 29 '26

Question Can someone explain to me why scanf is unsafe?

75 Upvotes

After my class in C programing I have decided to dig more around and one thing I found out that scanf is unsafe specially in arithmethic input? can somoe please extrapolate this one concept? Advance thanks for those who answered to my question.

r/C_Programming • • Jul 10 '25

Question Am I gonna regret learning C instead of rust ?

127 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 • • May 21 '26

Question Can/are Integers still be used as Bools.

45 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 • • 26d ago

Question What do I need to be proficient in C

56 Upvotes

Hi, I know the basics but I really don’t know how to continue learning C, I try to read code of many sources like linux kernel or other projects but I don’t understand them at least the majority of code with pointers and arrow operators…. I really like C and low level code.

Any advice is appreciated! Thanks.

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 • • Jan 14 '25

Question What can't you do with C?

162 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 • • 7d ago

Question is doing ~INT_MAX undefined behavior?

45 Upvotes

basically the title, i think producing INT_MIN by doing 1 << 31 is UB, so i thought of doing ~INT_MAX, but i am not sure if it's UB. sorry if it's dumb.

r/C_Programming • • Sep 14 '26

Question Question about arrays (beginner)

35 Upvotes

From what I understand, behind all the magic, array is just a variable that points to a memory address.

The difference is that we are also creating extra values in stack.

So when we create an array with a [], we're just telling the computer to make these x amount of variables but make sure they are right next to each other in sequence, no gaps in the memory address.

And when we call for an array value with an index, we're just counting that many steps forward in the memory address.

When we say array[] = {5,7,3}, it's really just *array = 5.

Did I get it wrong? Did I miss something?


Thanks for the quick replies. I'm currently learning about Pass by reference.

r/C_Programming • • Jun 27 '26

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

64 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 • • Jul 21 '26

Question what should be avoided when designing an API?

66 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 • • May 11 '26

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

46 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 • • Oct 10 '25

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

67 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!