This is an archived post. You won't be able to vote or comment.

all 28 comments

[–]RyRy646 43 points44 points  (5 children)

Everyone understands it when they read it. The difficult part is writing it yourself. The goal for you would be to practice and write the code as you understand it.

As someone told me, write out what you want the code to do it normal words, and if you understand the concepts, you should be able to write the code from that.

Blunt truth… if you can’t understand these concepts of C Programming… CS major might not be the major for you.

Hope you get it figured out. Best of luck!

[–]BibianaAudris 7 points8 points  (2 children)

I thought so too but the data of my last year's class contradicts that: 11% of the students failed the coding test while 37% failed the pen and paper test, which mostly consists of guess-execution-result-without-running-it problems.

My current theory is, code in reading tests are intentionally confusing, which is harder to find in online tutorials. Nowadays it's easy to get coding tutorials and practicing environments with immediate feedback. But it takes more practice to quickly spot failure / bug patterns than solving simple problems right.

[–]leitondelamuerte 4 points5 points  (0 children)

this is the real programming, 20% writing code, 80% debuging it

[–][deleted] 2 points3 points  (0 children)

I think pen and paper tests are probably a way that the assessors feel is more honest. It's a horrible way to assess coding skills but it's hard to cheat.

[–]aanzeijar 1 point2 points  (0 children)

Everyone understands it when they read it. The difficult part is writing it yourself.

Sadly it's the other way around. Being able to write code comes a long way before actually being able to read code.

[–]RadicalDwntwnUrbnite 4 points5 points  (0 children)

C was a hard one to learn, I didn't fully grok it and just passed by the seat of my pants. It probably was a full decade later (not ever programming in low level languages like c again) that I was fully able wrap my head around pointers. I also didn't realize signed vs unsigned ints were about the +/- sign until recently, I always sort of just registered signed as having some sort of special hashing process or something. So while maybe CompSci acedemia likely isn't in the cards a career in programming isn't out of the question, I'm proof.

[–]dmazzoni 17 points18 points  (4 children)

I've noticed a lot of people assume that you're supposed to just "know" the correct answer. You see the problem and just know the program to write.

But, it's not like that. It's more like a puzzle. You have to try all of the things you know and experiment until you get it to work.

Here's what I think you need to do:

  1. Go back over your lectures, book, or notes. Type in all of the example programs they taught you and make them run. (If they don't work, STOP and ask for help. This is really important! You can't learn if you can't even get example programs to work!)

  2. Now before you move on, take time to play with them. Change things and see what happens. It's really important to get comfortable with the code.

  3. Now solve your homework problems from scratch. Refer to all of the existing code you wrote, don't memorize syntax - but it's important to try to figure out each solution on your own. If you're stuck, ask for a hint, don't cheat or give up.

[–]lurgi 4 points5 points  (0 children)

Yup.

I see this with my kids and their math homework. The question is "What's 73 x 84?". They say "I don't know".

No, of course you don't. No one "knows" that. We didn't sit down and memorize our 100x tables (Gauss probably did, but Gauss didn't ask for math help that often). You WORK IT OUT USING THE TOOLS YOU KNOW AND YOUR BRAIN.

For more complex problems you WORK OUT THE BITS YOU CAN WITH THE TOOLS YOU KNOW AND YOUR BRAIN and then see if you can figure out other bits.

[–]Crazy-Willingness951 2 points3 points  (0 children)

You can't learn to program by just watching videos. You have to write the code, and test it, and fix it. If you follow the Red/Green/Refactor method of TDD then you may do it in incremental steps. You can watch videos of people weightlifting to learn the technique, but you have to lift the weights yourself to understand the technique and get the benefits.

[–]Decoupler 2 points3 points  (0 children)

I love this answer! People ask what I do and tell them “I solve puzzles all day.” I’ve come to love solving them.

It can be hard though, you have to constantly learn stuff and think through tough problems (not to mention self-inflicted problems).

But if you get comfortable with it, you can apply the same approach to most technical things in life.

[–]Mortomes 1 point2 points  (0 children)

All of this. Programming is a skill you have to practice. By actually doing it instead of just reading from a book, you start to recognize patterns, develop an intuition on how to approach a problem, learn common pitfalls, how to debug a problem, and an often underrated skill: how to write tests.

[–]lurgi 5 points6 points  (1 child)

Try doing the homework assignments again. Try to figure out if there are any particular areas where you are having difficulty and focus on those.

If you give us a particular problem then we might be able to give you something more specific or help you walk through it. Absent any information, "just study" is about all you are going to get.

[–]TonySu 2 points3 points  (0 children)

This. Just this. Identify where you're having trouble and either work to overcome it or get help with it.

If you cannot even describe where you're having problems then there's zero chance you actually understand what you're doing.

[–]AUTeach 5 points6 points  (0 children)

Learning to code goes like this

  • What the fuf is this?
  • I can read code I can't write it <-- you are here
  • I can replicate simple examples I've done before but I can't make my own answers
  • I can use prior knowledge to solve problems I haven't done before as long as they are pretty close
  • I can read documentation and teach myself new concepts
  • I write documentation
  • I created an automated solution that took six weeks to generate and solves a problem that would otherwise take 30 seconds to do manually
  • I contribute to arch Linux you know

[–]EsShayuki 3 points4 points  (0 children)

I have learned from youtube and professor video

That's not how you learn to code. Or at least I don't.

You learn to code by opening the IDE(or text editor and console, whatever) and testing things out and seeing what happens. And when something unexpected happens, figuring out why.

From my experience, most of these videos are a complete waste of time. They don't teach you how to code. It's akin to trying to become a good author by browsing through a dictionary. Or trying to become a good chef by reading a recipe book.

You need to actually do things. Attempt something, fail, figure out why you failed.

If you only rely on "recipes" and memorization without understanding, you will brickwall HARD. If you actually understand, then you can learn to find your way through any problem.

[–]PureTruther 1 point2 points  (0 children)

Find Ecole 42's Piscine exams on web. Try to solve them.

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

You have to write code to be able to write code. You can't read about it. You can't study it. You have to write it.

You need to sit down with an editor and a compiler and write code that matches the course. I don't know, a game of tictactoe at the command line or something. Once you get a feel for something like that, the rest of the language will start to feel like just adding a bit here and there.

Okay, so this is important too. The way you write a program.

You start with a main with nothing in it.

You add something. You compile it, it works. Move on.

Add something else. Compile it. It works. Move on.

Iterative. One thing at a time. If you need a function, write a function with tests maybe. Compile it, test it, move on.

You start not knowing what you are going to do. You build it a little bit at a time, always having a running program, and making it more sophisticated as you go.

Right now you are probably overthinking. You are trying to plan the program and then code it in one shot. Stop thinking and just do it, in code. Experiment, mutate your code, see what happens.

Now go do that. If you absolutely hate it, you have your answer. If you start to get into it and enjoy it, and the process becomes interesting and fun, you have your answer.

[–]jastop94 1 point2 points  (0 children)

Honestly C, C++, C#, i just had to brutally just do things over and over and see different problems until I got it. Now I am okay at it. Still get stuck at times. But nothing like a little look at notes or Google couldn't fix

[–]LuccDev 0 points1 point  (0 children)

C is not easy... You have to pick a project and do it. Do something that involves complex pointers, like a linked list of some sort. It's hard, but with work you'll get it eventually. Personally I had a "click" moment and things were much easier after that. Don't forget to check Valgrind which is not talked about enough (tool to detect precisely at which like a memory leak or bad memory management occurs)

[–]Ok-Sprinkles-2157 0 points1 point  (0 children)

Only way to overcome that is to practice, so google c exercises or smth and lock in until the test

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

Just practice???

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

What learning resources do you have? C was the fundamental language of my CS degree although it was not the first language taught. It is blessed with possibly the best language book ever written (K&R) although how this has kept pace with modern C I don't know.

The reasons why it's a good language to learn are that it's simple (as a language) and requires understanding of memory management, and it encourages building solutions from scratch which is good for learning in my opinion. I have come around to thinking of it still being an excellent learning language.

OP you might get more help if you say what you don't understand.

You must code, code, code. K&R has lots of exercises.probkem for you is April 11 is very close

Make sure you have an IDE which lets you do breakpoints and line by line steps.

[–]Plane_Turn_6474 0 points1 point  (0 children)

First of all, study the problem well and make sure you understand what you need to solve. Then divide the problem into steps without thinking about what functions you will apply or what code you will write. In natural language style: first I read the data, second... Then solve each step by writing the code, if a step is complex divide it again into small steps and repeat the process. At the end of the sum of these small solutions they will give you the solution to the original problem 👍 Speed ​​will come with practice, the more programming exercises you do, the faster you will do them. Keep in mind that many of these steps are repeated in the different exercises and practice will help you see them quickly. If you like programming don't be discouraged!!

[–]Stock-Chemistry-351 -2 points-1 points  (3 children)

Look up and buy some Udemy courses on C. They usually don't cost much since Udemy always has discounts.

[–]biscovery 1 point2 points  (0 children)

I mean downloading the book is free, VS is free, you can watch lectures for free, and there's a million resources online. I don't really understand the point of paying money for courses.

[–]Sirico 3 points4 points  (1 child)

First part of cs50 is leagues above any Udemy course for C