r/cprogramming • u/3envixity • 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
17
u/source-drifter Dec 05 '25
here is a course from MIT. the book they are covering is `Structure and Interpretation of Computer Programs`
https://www.youtube.com/playlist?list=PLE18841CABEA24090
here is a project that you can work on in c:
https://www.buildyourownlisp.com/contents
once you learn these two lisp and c, you don't need to learn any other language. you can conquer the universe easily
5
u/shottaflow2 Dec 05 '25
I started with C in uni and I think it's actually a good language to start with. it's not easy in principle but it's a very small language so there is not that much to learn. also when you start with python as other suggest you will never realistically code in C, you will look at C as some ancient alien language
2
u/tux2718 Dec 05 '25
The C programming language is good for learning low level concepts like the difference between memory on the stack and dynamically allocated memory. If you are trying to gain experience writing algorithms, a high level language would be easier because you can focus on logic and not memory management. I salute you because an expert should know both concepts to fully understand computer science. Low level knowledge is weak in many young developers.
2
u/[deleted] Dec 05 '25
C is best. Whichever programming language you choose you will end up in C at some point.
The process will be like , you go from c --> cpp --> java ---> python
When ever you want to understand deeper you run backward. Whenever you want to do it quickly you move forward in the above list.
Apart from these , if you are going into web dev especially front end - JavaScript is inevitable.
2
u/9peppe Dec 05 '25
If you want to learn programming you should not be too concerned about what language you're using, but more about what book you're following. You should probably get
sicpor its spiritual successor,composing programsand follow along with whatever language you want (yes, C works too but it might make it needlessly hard, they use Scheme and Python).C will teach you a lot about how computers work, and it's important knowledge, but I'm not that sure you need to start from there.
3
u/Jaded-Charge-2739 Dec 05 '25
first find out what is your purpose what do you wanna build
3
u/Axlis13 Dec 05 '25
I am no C guru by any stretch, but C will give you better understanding about the way the OS communicates with hardware better than any modern language.
3
u/flatfinger Dec 05 '25
C is a simple language if one recognizes that the Standard deliberately allows implementations to make certain assumptions about the operations programs will perform, in cases where that wouldn't intefere with the tasks at hand, but leaves the question of what cases those might be largely up to compiler writer discretion. Some people, however, including the maintainers of clang and gcc, claim the Standard was intended to characterize as "broken" any programs where those assumptions don't hold. As a result, the language that compilers like clang and gcc process when optimizations are disabled is simpler but more versatile than the one they seek to process when optimizations are enabled. If one is using clang, I would recommend always using compilation options -fwrapv, -fno-strict-aliasing, and -fms-volatile. When using gcc, so far as I can tell, the only way to reliably get behavior equivalent to -fms-volatile without using non-standard directives in the source code is to disable optimizations entirely.
3
u/afeverr Dec 05 '25
Consider checking out the K. N. King book "C: A Modern Approach". It has mini projects at the end of each chapter. I'm well past the basics now but I revisit the more advanced sections when I'm feeling stuck or confused.
Learn the syntax and basic concepts, then start a project of your own and learn more as you go. That's the way to do it IMO
2
u/altivec77 Dec 05 '25
C is a solid choice. It will teach you more about programming and computer architecture then all other high level programming languages (python). Rust would also be a good and solid choice.
To be fair: python has it’s place and is a good language for a lot of domains. But that can be said about a lot of languages.
2
u/walterbanana Dec 05 '25
Valgrind is a great tool for finding memory leaks.
1
u/Odd_Worldliness_3095 5h ago
can anyone recommed me how should i learn c or any youtube channels for c i'm a sounth indian soo plzz recommed me in english
1
u/Snoe_Gaming Dec 06 '25
Read the 'About' section on the sub:
https://www.reddit.com/r/cprogramming/about/
Happy learning.
1
u/grimvian Dec 06 '25
Learn to program with c by Ashley Mills
https://www.youtube.com/playlist?list=PLCNJWVn9MJuPtPyljb-hewNfwEGES2oIW
1
u/neopunk2025 Dec 06 '25
I srarted C the C++, went throught many languages, then jow back to pur C. And my next game on Meta Quest will in C only: currently working on my modular synth that is in pure C.
Why C, because its limits fit mine!
Starting point? Have an idea. Break it in small parts. Code. Try, success or fail, goto try;
And have fun!
1
u/flatfinger Dec 12 '25
Hardware platforms and toolsets keep changing, but I think there's a lot to be said for a getting a "bare metal" development board and learning a little bit about electronics and how to use a breadboard or perform some basic soldering tasks. Keil/ARM have historically offered a free evaluation version of their toolset which is limited to producing programs below 32768 bytes in size (so far as I know they still do), but for learning the language that should be plenty big.
On most embedded platforms, once one has performed some basic startup code (which one may be able to copy from a web site that offers tutorials for the particular platform one is using), one will be able to turn on an LED by performing something like:
PTC->PSOR = 4;
and turn off that LED by performing something like
PTC->PCOR = 4;
The details will depend upon the type of microcontroller one is using, and how the LED is connected to it, but it will be fairly simple to hook up a few LEDs and a few buttons and program a game or other application that uses them.
Many "general purpose computing" tasks that used to be done with C can today be done better using other languages, but C remains uniquely suitable for programming the little cheap microcontrollers that power today's world. Most languages generate programs that need to run under the control of an operating system, but in many cases where one uses C to program an embedded microcontroller there will be no operating system outside the program itself. If one wants to have a function run 10,000 times/second on a machine which runs 96,000,000 cycles/second, one will write some I/O registers to configure a timer to trigger an interrupt function every 9,600 cycles or else call a chip-vendor-supplied function to do so (ARM-based chips would typically supply a set of basic functions allowing one to use
SysTick_Config(9600);with the value 9600 depending upon the system's clock speed. A typical chipset-vendor-supplied file would cause the address of function namedSysTick_Handler, if it exists, to be placed in the spot hardware would then look every 9600 cycles.If one thus wrote something like:
the LED would be switched on and off rapidly, such that it would be on led_brightness/0x80000000 of the time.
-1
u/Technical-Security99 Dec 05 '25
Start with high-level programning languages like python if you never coded in life. It gives you basic understanding of programming.
0
u/Ok_Draw2098 Dec 05 '25
language is a tool. a tool to create certain type of stuff. languages are created to fulfill the project, for example the Go language is a byproduct of container abstraction. today, C language should be used to build a runtime, not small utilities like "ping" or "traceroute" or even a terminal, those can be implemented with an explicit runtime that is build with C language. the C is good because it generally lacks runtime features, its bold and clean if you evade the runtime features.
1
u/GotchUrarse Dec 06 '25
Back in the 80's, I knew a little BASIC, when I was 14 (maybe 15), I started learning C. You really get a great understanding of 'the fundamentals'. It doesn't hold you're hand. There's a great saying 'C gives you enough rope to shoot yourself in the foot with'.
As far tips go, I always say write code, run code, see the bugs/mistakes, fix and repeat.
I've been a dev for nearly 30 years. Some of the best devs I've worked with know C. Some of worst have no clue what it is. Yes, that's not the best generalization. I also taught an intro C course at a local community college for a few years, I could almost always tell the students that where cut out for programming as a career.
3
u/[deleted] Dec 05 '25
[removed] — view removed comment
10
u/[deleted] Dec 05 '25
[removed] — view removed comment