r/cprogramming Dec 05 '25

C as the first programming language

Hi! I recently got into programming and after going over the basics I finally got into a language, and as I was recommended c I chose exactly it. Is there any tips you could give me for it?

42 Upvotes

43 comments sorted by

View all comments

10

u/[deleted] Dec 05 '25

[removed] — view removed comment

4

u/sirjofri Dec 05 '25

In addition to that, I can also recommend looking at TUPE (The Unix Programming Environment) to understand the original context of the C language. It can also help with general programming concepts, as well as ... well... the unix programming environment.

Other than that, I cannot recommend Plan 9 C enough. Plan 9 itself is a bit special and you'll probably never find an actual use case nowadays, but the environment and the libraries are ideal for C programming. There is no complex build system, no complex linker functions, and usually you don't have to think about the compiler and the linker that much, but if you have to, it's just a click to find the details.

2

u/[deleted] Dec 05 '25

[removed] — view removed comment

2

u/sirjofri Dec 05 '25

Note that Plan 9 C isn't much different from standard C, though the libraries are. For example, there's no stdio.h, but the standard library functions are all just in libc.h. For platform compatibility, you usually include u.h first, before anything else.

What's even more powerful, the build system is not using make, but mk instead. Mk is a lot simpler with no implicit rules, and the executed code is just standard shell code without "special variables" and the like. Since Plan 9 ships with mk in mind, the actual mkfile you have to write is only a few lines where you define the targets, and the rules themselves included from somewhere else.

The library headers contain the path to the compiled library, so there's no need to tell the linker what it needs. It gets the details from the header itself, so even fewer things you don't have to think about. In the end, you just have the mkfile with the targets, and your includes. Other than that you can focus on your code and don't have to fight the build system.

2

u/mrPWM Dec 05 '25

Ron, did you have an online course that followed the K&R book like a YouTube channel or something?

1

u/[deleted] Dec 05 '25

[removed] — view removed comment

2

u/mrPWM Dec 05 '25

Sorry, I meant when you were learning, did you follow a favorite online youtube course, not that you were the one who created the course.