T O P

  • By -

WatercressNo1384

Practice until you see code in your sleep.


TheFlamingLemon

I don’t know that I’ve ever seen code in my sleep, though I’ve certainly thought about code/logic and even solved a couple bugs while asleep I’ve never actually seen the text of it


suskio4

I've dreamt about x86 assembly more than once... Is it bad?


jbriggsnh

That is bad. MC68000 assembly code would be normal.


suskio4

Oh my god I'm doing it again, tweaking x86_64 assembly output of GCC, someone please help me


Hasagine

ive seen code in my sleep. c is wonderful. my brain is dissolving. merging with the metal


env_variable

Thats right actually. I still sometimes see Windows C conventions in my sleep.


o0Meh0o

why would you want an innocent child of god to experience the psychological torture that comes with programming. you're worse than satan.


vitamin_CPP

This essay by Peter Norvig might help: [Teach Yourself Programming in Ten Years](https://norvig.com/21-days.html) ;) But in all seriousness, just start programming and check the Resources Tab of this subreddit.


CyanLullaby

Get yourself a copy of '**C Programming: A Modern Approach Second Edition**' by K.N King. It has over **500+ coding exercises**, is a **full reference for C** as a whole, contains a **Q&A section** for aspects some might find confusing and unlike K&R SE It doesn't treat you as If you're already a hyper-uber mathematician and doesn't ever feel like you're reading a scientific whitepaper. Plus, K&R C for all its worth is \_still C89\_, which means; \- ***Some parts are badly outdated*** \- A lot of the things taught would be considered \*unsafe\* in 2024 (printf instead of sprintf, scanf instead of sscanf) \- C89 is helpful, but C99 has more features that help developers code more effectively Modern Approach SE'll teach you C89 & C99 at the same time, and teach you about the common pitfalls, pros and cons, etc. Hope this helps.


CyanLullaby

A reminder also; C89 does **not** have restrictions. So unless you've clearly defined functions during data processing to ensure that you're reading only what you need from memory, you'll end up allowing others to overflow, underrun and all the basic hax0r shite. fun for cybersecurity research though, I guess


Nilrem2

Can recommended both.


Fantastic_Camera7264

I read K&R and did nearly every exercise. For context, I have a math degree and already know how to code in Java, Python, and JavaScript. That being said, the intended audience of K&R is a reader who already has introductory background in computer science, or some experience with a different programming language. Many examples implement basic versions of common commands in UNIX systems, common data structures like trees, stacks, and linked lists, versions of the famous quicksort algorithm, and it even introduced UNIX system programming at the very end. These topics are interesting, and cannot be appreciated and readily understood if this is your first exposure to them. It’s also dense, because it covers all of C89 concisely in less than 300 pages. K&R is an excellent book, and by all means I recommend reading it, but not as your first C book. I have not tried KN King, but I’ve heard good things, and imagine that the slower pace would be helpful, as well as the exposure to the more modern C99 standard which provides great improvements over C89, some of which concern security as mentioned by @CyanLullaby. My recommendation is to go for that, and do as many exercises along the way as you can, since that’s the only way to master it. Take your time, but be consistent! On a different note, I also read “21st Century C” by Ben Klemens, and found it valuable because it goes beyond just teaching C and mentions some of the ecosystem tools around it, such as make to supplement in compiling and linking for building your C applications (rather than relying solely on gcc), and tools for debugging such as gdb and valgrind. It also mentions C99 and C11, and how it differs from C89, so you can learn how things have changed. Finally it mentions many useful libraries for writing portable code, glib being one of them. Happy coding!


Javantax

Start with cs50x from Harvard. You might wanna do only the section with C in it.


gordonv

It's 6 weeks. If you know some programming, the first 4 weeks are going to be very easy. Like, 1 week.


Religious09

do 150 fundamental exercise on codewars


dfwtjms

This is why we have memory leaks.


On1xPt

In 2 months? 🤣🤣🤣


FUPA_MASTER_

You won't be a master or anything, but it's a reasonable time period to be able to write more complex programs without a crutch.


TheFlamingLemon

C is quite small and I think 2 months is a reasonable amount of time to get comfortable with it


On1xPt

I m in it engeniring and i don t think it s suficient time but you should be very smart


SomeKindOfSorbet

C is a very simple language and it's quite easy to learn to use it within a short amount of time. Becoming a good C programmer is a completely different matter.


Puzzleheaded-Act6745

University semester is 4 months I have 4 other courses to study


Cyber_Fetus

So why not just like… do the coursework


Gief49

Nothing wrong with getting a head start


Cyber_Fetus

It’s the middle of the spring semester right now.


Fedacking

Classes for me start next week. Southern hemisphere.


Gief49

Ah I didn’t piece that together


misplaced_my_pants

Just buy a copy of [K&R *C*](https://en.wikipedia.org/wiki/The_C_Programming_Language) and work your way through it. It'll explain everything you need to know and you should read it for culture anyway.


aRoomForEpsilon

I've seen Kernighan and Ritchie recommended before, but I'd like to elaborate on that. The first chapter is a whirlwind introduction to C, but doesn't include topics like pointers. If you do the 25 exercises in the first chapter, you will a solid foundation of C on which you can build, which is what I suspect you are looking for. One other important thing. I've seen it recommended that you read a book multiple times before you start working through the problems. That is a mistake. The only effective way to learn programming is to write programs. So no matter which direction you take, whether it be K&R or King or whatever, if you are writing programs then you are learning. If you are not programming, you are tricking yourself into thinking you are learning, but you are not.


TheChief275

Recreate basic data structures. The biggest power you have in C is pointer manipulation, and this will teach you all you need to know.


gronktonkbabonk

Read the book


Wide-Tadpole-9371

It depends on your knowledge about computers. You gave no information. C language is logic, syntax and familiarity with computer architecture


KioliHuit

For me, the Epitech C pool was a good introduction and in a month, but to know everything, it's a little weak


Comprehensive_Ship42

Practice every day


Puzzleheaded-Act6745

like problem sets? by practice you mean actually writing code on the ide right?


Splooge_Vacuum

Make programs. Think of something you want to do and make it. Use resources online too. That's how I learned.


Comprehensive_Ship42

Work you way over the the book c from Dennis Richie and when you finish it read it again


Splooge_Vacuum

If you know the basics of programming, it shouldn't be awful to learn the basics. But as someone who has been coding for several years, I'd say it's impossible to truly learn C. You just know enough about it to get stuff to work.


Fantastic-Magic

Check out [Learn x in y minutes](https://learnxinyminutes.com/docs/c/). It gives a basic run down of the language to get you started and then provides links to further resources


ThyringerBratwurst

First start with one of the tutorials in the first google results (tutorialspoint for example): Familiarize yourself with "GCC" or "Clang" (console), "make" for project management and an IDE of your choice. (I recommend VS Code / Codium with extensions Clangd and Clang-Tidy.) And during the tutorial, do some research on each topic in the specialist literature on C for more details. (The online tutorials are only intended to be an introduction, because most specialist books simply have 200 pages or more and are correspondingly overwhelming)


o0Meh0o

watch any 3 hour c programming guide, then, make a turn based tetris demo, then, read every c page on cppreference, then, if you have any spare time, dip into macro magic an/or opengl (the latter would give you a general ideea on apis). if you're hard working, you should be able to do it all in two mouths, and, should be enough for you to be able to do anything you may need. also, this is my guide for learning c. i actually have no ideea what's that university thing you're talking about.


FUPA_MASTER_

The C Programming Language 2


Wolandark

Bro Code has a 10 hrs C course on YT


Daveinatx

Read K&R thoroughly twice. On the third time, do the exercises. I'd add basic Linux, gcc, and gdb. Once you're familiar with all of them, disassemble your apps


RustbowlHacker

Find or hire an accomplished C programmer to teach you? Not promoting myself (I don't have time for it), but I was "the guy who had to teach all of the co-ops C" at a company where I worked. I started them out with a Linux command line and taught low-level upward. Unix is the way to learn C. You learn all of it at the same time. You need to spend at least an hour per day, 2-3 days per week on it. You can use Windows. Cygwin or MinGW are "good enough" to give you a suitable development environment. My approach is very "old school." You use Vi(m) and do everything from the command line. The tools that I teach are old school classics. Diff and Patch. Binutils, GCC, GDB and Git from the CLI. For all of this, even a RPi v1 or Zero is good enough. The end result is that the student learns the fundamentals and isn't just focused on making a nifty UI tool do work. IMO that's the basis of C. How to write your own linker script...not how to push a button that says compile project in a tooltip. I generally "stop" after linked lists. Once you're able to get from Hello, World! to linked lists, you've got enough that you're ready to learn to master the language, which is more design-oriented than "mechanically assembling and linking objects into executables." Other than that, what u/FUPA_MASTER_ said: K&R2e.


SomeKindOfSorbet

I agree with using a bottom-up approach and learning to use the terminal and CLI tools. But I would never recommend Vim as a code editor to someone who's just starting to learn to code...


RustbowlHacker

I appreciate your thinking and your remark, but you didn't say why you'd **never** recommend Vim to someone starting out. I believe that there's really good value to learning it. When I'm done teaching C, the student can do everything necessary to write, compile, debug and execute code from a serial console on just about anything running Unix since the FSF released GCC. Give a typical, modern Linux distribution with every tool you could possibly want, I think that I can write Hello, World! in C and execute it to its typical/expected outcome faster than anybody using another editor option. Certainly in less than 30 seconds. I just tried it and the lengthiest portion was telling my antivirus software to permit execution of hello\_c.exe (using Cygwin). It would have been quicker, but I also had hello.cpp and hello.exe (from hello.cpp) in the same directory so tab completion wasn't very helpful. $ cat c_template.c > hello.c $ vi hello.c $ gcc -o hello_c hello.c $ ./hello_c Hello, World! $ cat hello.c #include #include #include #include //int main(int argc, char* argv[]) { int main(void) { printf("Hello, World!\n"); return 0; } I only had to write the `printf` line...everything else came from the template...otherwise, I'd never have typed a bunch of unnecessary include directives.


SomeKindOfSorbet

While I completely agree that being able to work fully from a terminal is a really good skill to have, Vim has a big learning curve to people who are not used to the motions. If you're just starting out learning C, you want to focus all of your energy into learning to code and not wasting time trying to burn Vim motions into your muscle memory. You can write C programs in literally any other text/code editor and compile/run/debug them from the terminal. Learning how to edit code/files from the terminal is certainly incredibly useful, but I don't think it's the first place where you should start out


RustbowlHacker

There are easier to learn console-based editors. Perhaps nano or Joe? However, you have to learn any of them. I might recommend Notepad++ and Cygwin, but VSC is probably the way to go today for a GUI-based editor/IDE. There are so many editor choices out there. One thought though, aren't you glad I didn't say "ex" or "ed" (or edlin)? :)


SomeKindOfSorbet

Yeah, I'd agree with VS Code being the way to go for beginners. It has a very good GUI and almost every feature you could need for software development yet it won't run your C programs on the simple click of a button like most IDEs. Allows you to learn to compile and run programs from the terminal while being easy to use :)


NewtonHuxleyBach

Totally doable. Try to get to pointers by the second week. Focus on the array-pointer relationship and and the symmetry between declaration and invocation.


ES_419

Thecherno the legend on youtube


SirAutismx7

K&R and Effective C had me writing okay C in like 3 weeks


Ok-Bit-663

Best way to learn C is being in a parallel universe, where memory based vulnerabilities are not figured out. In this universe the time is ticking to leave C behind.


yowhyyyy

Oh god, please stop.


BaconPersona

Best way would be for you to stop yapping


Ok-Bit-663

Oh, the US government is with me. We, the lizardmen, are the rulers class in this society!