r/cprogramming • • 3d ago

How should i..?

How should i start learning C as my first language? Could anyone share some advice on where to start with C?

0 Upvotes

19 comments sorted by

12

u/lfdfq 3d ago

Go write some C code

1

u/70Shadow07 3d ago

Ceeing some Go code is not that bad of an idea either to be perfectly honest

2

u/nnotg 1d ago

Underrated comment.

10

u/nnotg 3d ago

Rename this sub to r/AskHowToLearnC or r/ShouldILearnC.

5

u/pseudo_shell 3d ago

Honestly should be a banned post type by now.

5

u/MarijuanaWeed419 3d ago

Beej’s guide to C programming is pretty good. I know it says it’s not intended to be an introduction to programming but I didn’t have any issues with it

3

u/henryyoung42 3d ago

K&R - do it old school !

2

u/bearheart 3d ago

That’s how I learned. Of course that was in 1973 but it’s still a good book. Just keep in mind that the language has evolved a bit since then.

2

u/henryyoung42 3d ago

It was 1981 for me, learning 6800 assembler at the same time. I almost suggested to OP that he also study the disassembled compiler output. I went on to write a C disassembler for 6502 which made it clear that addressing modes mapped to opcode bits which made sense from an instruction decode logic perspective, 8-bit CPUs being pre-microcode days.

2

u/bearheart 3d ago

I also wrote a lot of 8086 and Z80 code back in the 70s and early 80s.

Kids these days have no idea how easy they have it! /s

2

u/lounatics 3d ago

On a high level:

  1. Learn the absolute basics.
    1.1 How to set up a code editor + compiler
    1.1 How to write a "Hello World" Program.
  2. Fuck around
    2.1 like just make some dumb stuff:
    - try to complicate your hello world program,
    - try to make it differently,
    - make it ask the user for their name and greet them personaly
    - make it print the contents of a directory.
    - and so on...
  3. Find a project
    3.1 What's a problem you'd like to solve? What's a Program you'd like to have?
    3.2 try to figure out what you need to know to make it happen!
    3.3 try to make it happen.

Use your preferred search engine and the books/guides other have mentioned to solve the problems you encounter in each step and you should be doing ok!

1

u/extoniks 3d ago

As most of us learned - Books like K&R's The C Programming Language and others, Official docs. I also recommend man pages and I use it a lot till now.

1

u/gm310509 1d ago

Could anyone share some advice on where to start with C?

The sidebar? There seems to be a list of resources over there.

-4

u/zezrol 3d ago

Code tracing! Make ai generate or search some study guide online. Pick one topic at a time, build on foundations, make ai generate a simple code for each topic, get a pen and paper, code trace line by line starting from main for visualization. Write your own code.

2

u/bearheart 3d ago

Please don’t try to learn from the global psychotic plagiarism machine!

2

u/zezrol 3d ago

Damn didn't know you guys are that against it, its genuinely how I get most of my classes today. It's pretty normalized here to use it as a tool. Ig this a different perspective.

1

u/bearheart 3d ago

It’s often wrong and will teach you wrong things.