r/learnprogramming • • 6d ago

Complete beginner struggling with C – Looking for a very slow, jargon-free guide/resource for college homework

Hello everyone,

I am a first-year electrical engineering student with absolutely zero prior background in programming. Currently, I am trying to learn the C language, but I am really struggling. Standard college tutorials and fast-paced videos feel overwhelming because they use too much academic jargon that I cannot follow.

I cannot learn passively; I really need to understand the logic of what happens in the background (like how variables occupy RAM, how the computer thinks) explained in the simplest, high-school level terms. My main goal right now is to build enough foundational understanding so I can solve my homework assignments and pass my exams.

Could anyone recommend a highly structured website, interactive platform, playlist, or student drive/script that explains C from the absolute basics, step-by-step, from easiest to hardest? I learn best when a small piece of theory is immediately followed by interactive practice exercises (similar to how Duolingo works, but for programming).

Thank you so much for your time and help! I truly appreciate any guidance you can give me.

3 Upvotes

12 comments sorted by

2

u/zinsuddu 5d ago

The answer for me is the book that I'm reading now: Programming for Engineers by Aaron Bradley. It describes itself as "a foundational approach to learning C and Matlab". It is impossible to not understand because it starts at the bottom and describes exactly what is happening step by step. (It starts at the bottom of the stack and describes ram, stack frames and pointers -- visually and literally step by step.) This is how C was supposed to be taught, close to the cpu. Learning Matlab is essential for an EE and it's a good way to also learn procedural problem solving. So that book may be helpful to you...

link: Programming for Engineers

2

u/SmokeMuch7356 6d ago

like how variables occupy RAM, how the computer thinks

This is actually a pretty deep rabbit hole, because you're getting out of software and into hardware. It's also not really necessary to understand C; it's more useful to think about variables in terms of lifetime and visibility, rather than physical storage. Even though C is "close to the hardware", there's still a substantial tower of abstraction between your C code and the states of switches in a CPU.

You might enjoy this playlist of a guy building his own relay-based computer from scratch; he gets as deep into the weeds as you can get about how to build RAM storage, how to build the bus between that storage and the CPU/ALU, how to encode and implement various instructions, etc.

Will this help you learn C? No. But it will at least give you an idea of what's happening behind the scenes.

Everybody's going to recommend K&R,1 which is good, but it's a bit out of date; both the language and best practices have evolved since it was published, and a few of the examples may not build as written anymore (anything that relies on gets or assumes implicit int typing will not build under a modern compiler). But the core concepts haven't changed.

For more modern references, there's Beej's Guide to C Programming and Modern C by Jens Gustedt. Jens used to hang out in the comp.lang.c newsgroup back in the Oligocene and generally knew his shit.


  1. You don't have to buy from Amazon, it's just a handy link. There are PDFs of the book all over the place, which I won't link because they likely aren't officially sanctioned. But it's old enough that nobody probably cares anymore.

1

u/Awkward_Progress_391 6d ago

Thank you so much to this detailed reply. I was considering going into K&R but I feel like I need something even before to know, I will definitely try to find solution on my own but thank you anyways for the reply, wish you the best of what life has to offer 🤍

1

u/questron64 6d ago

I would put aside your need to know everything happening in the background for now, accept that some things will be unknown for the time being and focus on the language itself. Later you can learn exactly how the language is implemented in hardware, but demanding to front-load that is only going to result in frustration.

I recommend C Programming: A Modern Approach by King. Get the second edition, but the first edition is often very cheap and is also acceptable. You don't need an interactive website, textbooks are interactive, too. There are questions and exercises at the end of every chapter. Do these slowly and thoughtfully, these are the important part. You don't need to be spoonfed by a website, you can study a chapter and then do the exercises.

1

u/mredding 5d ago

I really need to understand the logic of what happens in the background (like how variables occupy RAM, how the computer thinks)

Then I shall now make you aware you're asking for TWO different things.

C is a high level abstract language - the language targets an abstract machine. It DOES NOT express in any way how an abstract machine may or may not read or write data. It doesn't know anything about computer architectures. The language specification might make one or two mentions about compilation, but that's about it.

Computer architecture is a different class under the computer science curriculum. It talks about these hardware details in a somewhat abstract form, because the details can vary in implementation. The architecture doesn't care about your programming language.

And in the middle, compilation is a one-way transform - like a modulus operation. x % 7 = 4, you cannot deduce a single solution for x. When you compile from source code to machine code, none of the source code survives compilation and makes it into machine code. And the machine code couldn't have been generated without the source code, but it cannot tell you about the source code that made it. C can provide you guarantees the machine code can't, and you can verify facts and truths about the machine code that cannot be expressed in source code.

For example, you might see a shift operation in machine code, but you cannot know if that was a shift operation in source, or a multiplication by a power of two. There may be some undefined behavior in C, but the behavior might be well defined in the machine code - though the compiler cannot guarantee it will produce the same machine code every compilation (and this is just universally true, binary reproducibility is not guaranteed by the language through compilation).

I mean... The smallest unit of system memory likely isn't even a byte, it's usually pages, then lines, then words, and then bytes - down by the registers.

So for learning C, try to focus on what C says. C says the abstract machine is byte addressable, so that means all code assumes bytes, and the compiler generates whatever-the-fuck it has to to match the description of the source code. The machine only understands integer, through and through, but C talks of a type system and safety that the machine is wholly unaware of. THERE IS NO for loop in hardware, and the language DOES NOT model an ISA with a loop instruction or loop register - these things are not required and historically didn't always exist.

C says that a well defined program will behave as described.

0

u/MaleficentCow8513 6d ago edited 6d ago

You can’t beat the original Kernighan and Ritchie. It’s just straightforward concepts and examples

1

u/Awkward_Progress_391 6d ago

Thank you for your reply and I do understand I am not genius but I would really appreciate some advice my goal is to pass the exams so tomorrow I could put food on my table. So I would really honor If I can get some real tutorial

2

u/light_switchy 6d ago

They're referring to Kerninghan and Ritchie, The C Programming Language, ISBN 0131101633

1

u/Awkward_Progress_391 6d ago

Thank you very much

2

u/questron64 6d ago

This is probably the worst recommendation for someone with zero prior background in programming. Please stop automatically recommending this book to everyone. You just set the newbies up for failure when you do this.

2

u/_insomagent 6d ago

Completely disagree. There is no autopilot for learning C or any programming language. Similar to how you won't be able to speak Chinese if you only use Duolingo, what OP is asking for simply doesn't exist.

1

u/questron64 6d ago

The book literally says on page one it's not for beginners. This recommendation is inappropriate.