From which problem set onwards should I start implementing functions? Is there any disadvantage in using functions when it comes to grading?


There's no right answer to this. You can start implementing functions as soon as you wish, or as long as you can do without, as late as you wish. There is no advantage or disadvantage in grading. Programs are scored strictly on whether they produce the exact output.

The one exception to this is that pset5 requires functions in that it is split into two program files - speller.c and dictionary.c, and you aren't allowed to change speller.c where main is stored. All the functions are in dictionary.c, so at that point, implementing functions is a requirement, but the structure is pretty well finished for you, so even here, it's not much of a leap.

There is one advantage to doing them sooner. You get more practice!

If this answers your question, please accept this answer to remove the question from the unanswered question pool. Let's keep up on forum housekeeping. ;-)

  • Before this gets flagged as an opinion question, I would say that it should stand. Yes, it is an opinion, but a valuable question for CS50 students to understand. That's just my opinion, I could be wrong. ;-) – Cliff B Jul 4 '15 at 8:02

functions are used to make code more modular and easy to maintain. the programs you write as you start off are very small though.

a program that says "hello, world!" for example could be like 5 lines long (including the braces). creating a function would make it unnecessarily like 10 lines long.

functions are mandatory for larger programs. they make you write less code and make your code very organized and easy to maintain. I would say around is a good time.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .