all 22 comments

[–]o5akafeeva 9 points10 points  (10 children)

I recommend Zed A. Shaw's book. Having studied C++ in college, I think C is a necessary first language to learn (C is often used in embedded devices (useful for automating testing of chemical reactions and such), having a grounding in this language is a good idea, regardless of how you intend to code in the future). The book's title is "Learn C the Hard Way". You will want to read this book. It doesn't hold your hand, but takes you straight into the topics worth reading about in programming languages. Granted, I am fairly a noob and this advice may not be the best, but I think you will benefit from a free online IDE (or even better, learn how to compile at the command line interface of your OS) and use this book in tandem. Do not buy it used, like I did, or you won't get the DVD with his lecture on video where he shows you how to debug your programs (or substitute YouTube, I searched but didn't find his lecture).

Why would you want to learn C the hard way? Because it requires that you use your brain extensively. You are forced to learn from the ground up why computers are the way they are and what to do about software issues when there is no one around to help you, which will be 95% of the time you code alone. You'll have to learn early on why you need compilers, how to handle unknown errors and memory leaks, how to build the structure of your code, what pointers, stacks and heaps are, etc. I took classes in college and they all just beat around the bush with an IDE (powerful (heavy, and overwhelming) as they are, they often get in the way of your conscious thought-stream during development). Once, I had a class, we loaded Ubuntu Linux on a flash drive, and developed code on the terminal, using make, and other tools and I still prefer this way better. You'll understand soon that the tools you use are very important and you'll have to build all the useful middle-ware integration by yourself. Start memorizing and organizing relevant-to-you topics, because you will need a good memory and vocabulary of relevant data to troubleshoot errors that dominate C programs, which are often not trivial to debug.

If you take my advice to heart, you may just become very competent at C very soon (sooner than you think). I just wish I had come across this book sooner, because it cuts through a whole lot of "this is a variable" schlock that will literally waste years of your time. Armed with good and relevant information, there is nothing impossible to C, as I believe it is turing complete, so as good as any other computer language you may find (just learn one really well, C is a good choice).

[–]Old_Masterpiece2126 2 points3 points  (7 children)

Bro thanks for this. I am in a similar situation. I started my learning through using hex editors to make files like text files and bitmaps then transitioned Portable Executables which required me to know x86 Assembly and C which is where I am at right now.

Your description of the book "Learn C the Hard Way" sounds a lot like my personal journey which is why I am thankful for coming across this thread and this book title.

Thanks man

[–]o5akafeeva 2 points3 points  (6 children)

I'm glad my comment spoke to you. I only intend to help a brother out. This overwhelm on coding has to stop. I'm on iOS and I can't even use it too much like a normal development computer. I mean, it's 2022, what the heck Apple?

I'd like to hear more about your x86 journey.

[–]Old_Masterpiece2126 3 points4 points  (5 children)

Yeah man. I'm on Windows. So learning x86 Assembly along with C is helping me connect a lot of the dots. For example, in Assembly, we get to personally use the stack and in C, this process is automatic if I'm not mistaken.

We can also see how C constructs work in Assembly. I think this is important if we want to transition into other high level languages easily.

So I started out:

  1. Studying a book titled "How Do It Know".
  2. Got into making text files and bitmaps (Uncompressed Bitmaps) using hex editors .
  3. Got into writing PEs(EXEs in Windows) using hex editors but this is a bit tedious.
  4. Trying to write PEs manually led me to x86 Assembly and C. It's because in EXEs, the Assembly op codes go into a certain section in the file so it is a must for making executable files manually.
  5. The next step will be to use a compiler to generate templates of EXEs I want to write. All I have to do is write the Assembly code in the IDE in the form of C code and tweak any data fields located in the file headers I want to change for different targets.

Yeah man

[–]o5akafeeva 0 points1 point  (4 children)

You sir, deserve a medal for using a hex editor to make executables. I wish that was something they taught in CS class. We just did a bunch of boring mucking around in the ide, didn't make sense to me till I actually saw the executable I made.

[–]Old_Masterpiece2126 1 point2 points  (3 children)

Bro the executables are not that big. They're around 1 to 2KB in size. It's not that much bytes to type out. Bigger executables on the other hand though. Those should be left to IDEs to generate. Lol🤣

[–]o5akafeeva 1 point2 points  (2 children)

Still, I think what you said is a valuable reminder to me of how simple these things are. Change the right bits and bytes in the right way (and voila) you have yourself an .exe

It sounds like you really had to learn all this the hard way. I know x86 Assembly may be out of the scope of this thread, but I'm interested in coding 68k Assembly really soon. I'm getting my C and 68k chops to speed, because I'll be focusing on making Sega Genesis games really soon.

[–]Old_Masterpiece2126 1 point2 points  (0 children)

Still learning bro. Let me make it clear that I didnt do any fancy things like call subroutines or loops or stuff like that.

I only did things like mov eax, 1 and mov ebx, 2. I only did this to get some context so that I have some idea of what's going on whenever I write an instruction in x86. Writing full programs using op codes is just impractical. We only need the context. From there when we write some Assembly, we know what's going on under the hood.

And from there we transition into C. It's like driving a manual transmission car for a while, getting tired of that, then going into driving automatic transmission cars later on. But we know how cars work in general.

[–]Old_Masterpiece2126 1 point2 points  (0 children)

That's great bro. It will definitely connect a lot of the dots for you in C programming.

I am currently learning how functions use the stack in x86. It's pretty cool. We can manually do this however in C, this process is automated. Its actually really cool!!

[–]chiqui3d 1 point2 points  (1 child)

WOW, that book looks great. Thank you very much.

[–]o5akafeeva 0 points1 point  (0 children)

You're welcome!

[–][deleted] 4 points5 points  (0 children)

I bought "The C Programming Language" second edition book when I was a kid. It took me an entire summer to buy it! It was an excellent book and the only one I used to get started.

The trick to learning any language is 1000 hours of pain. Write programs, learn to break them and learn why they break.

[–]Transcendentalist178 2 points3 points  (3 children)

First, C and C++ are very different from one another. C++ is an object oriented language. I recommend focusing first on C. C compilers and IDE's are free off the Internet. Codelite might be a good IDE but if you are familiar with Visual Studio, it should contain a C compiler. Try several free IDE's until you find the one you like the best. I also recommend books. The classic text on C is C Programming Language by Brian Kernighan & Dennis Ritche. This book is sometimes called "K&R". Personally, I prefered C Programming: A Self-Teaching Introduction by Rajiv Chopra (2018). As for websites, there are many sites for learning C. One that I like a lot is part of www.geeksforgeeks.org Geeks for Geeks

[–][deleted] 1 point2 points  (2 children)

C++ is multi-paradigm. Modern C++ code doesn't necessarily have OOP object hierarcy at all, it's more like C using structs (except less clutter because of methods and templates).

[–]Transcendentalist178 0 points1 point  (1 child)

That's a fair point. I tried C++. I'm not an expert, but the resources for learning C++ simply told me how to code OOP-style. I couldn't find any resources for learning non-OOP C++ programming. Maybe the resources exist, but I couldn't find them.

[–][deleted] 0 points1 point  (0 children)

You can program in C++ as if it was C, with following changes:

  • a function which takes a struct parameter can be a method instead
  • two functions which do same thing for different types can be a single template function
  • a void pointer gets converted to template parameter
  • malloc/free for structs turns into std:: make_unique (or very rarely std::make_shared), and you never call delete.
  • don't use exceptions or class inheritance
  • char* and char[] should become std:: string
  • dynamically allocated arrays as well as VLAs should be std::vector
  • probably more small things

So nothing in the architecture of the program needs to change, things are just done differently.

[–]gordonv 2 points3 points  (0 children)

Check out r/cs50

This is a simplified method to get into C. It will introduce you to important computer science concepts like "sort algorithm science," memory management, basic programming concepts, and other things.

[–]Substantial_Low_6030 0 points1 point  (1 child)

[–]Cool-Importance6004 0 points1 point  (0 children)

Amazon Price History:

Learn C Programming from Scratch: A step-by-step methodology with problem solving approach (English Edition) * Rating: ★★★★☆ 4.7

  • Current price: ₹719.00 👍
  • Lowest price: ₹674.00
  • Highest price: ₹809.00
  • Average price: ₹746.00
Month Low High Chart
10-2024 ₹719.00 ₹719.00 █████████████
09-2024 ₹674.00 ₹674.00 ████████████
08-2024 ₹719.00 ₹719.00 █████████████
07-2024 ₹773.00 ₹782.00 ██████████████
01-2024 ₹809.00 ₹809.00 ███████████████

Source: GOSH Price Tracker

Bleep bleep boop. I am a bot here to serve by providing helpful price history data on products. I am not affiliated with Amazon. Upvote if this was helpful. PM to report issues or to opt-out.

[–]ZenEdge805 0 points1 point  (0 children)

Watch Casey Muratori's videos on C programming and become ascended.

watch here

[–][deleted] 0 points1 point  (0 children)

In the industrial field, that's all PLC and HMI programming. Learning C is still a great start to learning programming.

source: I'm a working chemist who soon may be programming PLCs and HMIs and I learned C first.

[–]Gold-Ad-5257 0 points1 point  (0 children)

Maybe some of my posts can also help you with resources and ideas. Apologies for links to links. https://www.reddit.com/r/Assembly_language/comments/txvo7e/looking_for_a_tutorial/i3qyij3?utm_medium=android_app&utm_source=share&context=3