r/C_Programming • • 10d ago

Question Questions in C

Guys I'm a student and I NEED a source for good questions in C. Like ones where I have to code the answer, debug the code or find the output(tricky ones)

tbh I don't know any place for coding other than leetcode too, so for all coding languages in general how am I supposed to practice questions? Apart from leetcode what are good places to practice coding?

0 Upvotes

20 comments sorted by

11

u/PseudoFrequency 10d ago

No one mentions Project Euler anymore. It's more math/logic puzzles than C, but it requires you thinking through a problem. You can use any language. I've solved dozens/hundreds just for entertainment, mostly using C.

1

u/Goated_AstroPhantom 9d ago

I'll take a look into it, thank you

2

u/knouqs 9d ago

I love Project Euler but I don't particularly think it's useful for learning programming as it's prime focus is on math.

2

u/SchemeWestern3388 9d ago

In the first two dozen or so problems, you’ve covered reading files and formatting data, explored various data structures and had to come up with your own, and probably worked through several variations on an algorithm for efficiency. You’ve written and reused functions and explored your standard library pretty well. You also get to look at others solutions, often seeing the language used at its most powerful. All of this in very small chunks of code, often twenty lines or less. And you learnt some math!

I think it’s a great start to learning any language, and if I’m looking at a language that’s where I start. Admittedly, there’s a lot more to coding than that, but it’s a good base. 

1

u/Dazzling_Music_2411 6d ago

You still have to devise the strategies for problem solving and program them.

After you solve each problem you can see other peoples' solutions. It's daft to say it's about Maths. It's not. It's about problem-solving, including many popular paradigms, recursive programming, dynamic programming, etc. Some of the very advanced problems may touch on a bit of maths, but that's not the point.

I think people just hear "Euler" and assume it will be maths.

1

u/knouqs 6d ago

Perhaps. I was taught that we solve problems using the best tool available, not to pick the tool to solve the problem.

C is often not the best tool available to solve Project Euler's problems.

1

u/Dazzling_Music_2411 6d ago

Project Euler is language agnostic.

It may be that C is not the best language for YOU to tackle Project Euler.

It is nevertheless a fine and excellent language for many people to do just that. The OP wants to exercise his C skills. Personally I think it's an excellent platform for the purpose, especially for a beginner like OP, as it offers such a wide variety of challenges, rather than just the hackneyed approach of more banal DSA oriented sites like bleatcode or whatever.

The OP is not asking for a recommendation of a general-purpose language. If he were I might not recommend C either. But that's irrelevant. He wants a site to practice programming. PE is an excellent community for that and lots of people tackle the projects in C, despite what you or I might think.

1

u/knouqs 6d ago

I understand that. My point remains that Project Euler's projects are not a good choice for learning or practicing C.

1

u/Dazzling_Music_2411 6d ago

Honestly trying to understand why on earth you'd say a thing like that.

I've done PE, not all of it, but to a reasonably advanced level (not using C) and most of the questions I remember would be a brilliant way to exercise C, imho.

4

u/knouqs 10d ago

Have you tried a C programming book? You might not get answers for the questions in the book, but you should get everything you need to know about programming for the solutions.

Let me add that if you get stuck in any question in a book, asking here is a reasonable approach. You are going to find people who are willing to help you to the solution.

1

u/Goated_AstroPhantom 9d ago

thank you, ill try it

3

u/Direct_Chemistry_179 10d ago • Bravo

Check the resources sidebar of this sub.

I bought the book The C Puzzle Book that is reccomended there. I haven't started reading it yet, but it looks very similar to what you're describing. It was also very cheap if I remember correctly, on half price books.

1

u/Goated_AstroPhantom 9d ago

wow thank you so much

2

u/corsa__rebaixado 10d ago

To answer tricky questions, you could use python Tutor debug and see the output (only works on small codes).

Another good site for practice is Code forces, but leet code is great too

2

u/Murky_Respond1966 9d ago edited 9d ago

There is grademe.io
There are interactive problems to solve, but there are no explanations.
Problems look a little like problems from school 42. (limited number of functions to use)
For tricky ones go to challenges mode.

2

u/BotSlamminDayNNight 8d ago

exercism's C track plus the K&R chapter exercises are the closest thing to what you're after. You also get the debug-and-predict-output practice for free by reimplementing libc functions like strcpy or qsort from scratch and testing them against the real ones.

1

u/Murky_Respond1966 9d ago

https://www.codewars.com/
also has little practice code problems.

1

u/Recent-Durian-1629 9d ago

better start with reading the c projects on the github.. that's will be the good start.. you will find value to real c that's in the production and learn the c fast way..

if want some youtube : watch tsoding

1

u/Dazzling_Music_2411 6d ago

Linux Systems Programming by Robert Love has lots of good use cases for C.