Learning C/C++ through exercises

In summary, it is possible to learn C and C++ in a different way, and it is important to choose the language that is best for the task at hand.
  • #1
Avatrin
245
6
I often find it quite frustrating to learn a programming language through a book; I always find myself skipping through huge parts of the book I have to read before moving onto the exercises. That was the main reason I did not ace my Python exam at university; I was told to use syntax I hadn't even seen until exam. I had done most of the exercises, but apparently not the right ones.

However, I am quite fond of websites like Codeacademy; You get a bite-sized text to read before you are told to use it in an exercise. However, it does not go very in-depth. Also, it does not cover C or C++.

Are there books or other resources that are structured like that? This question is about C and C++.
 
Technology news on Phys.org
  • #2
I have always been a big fan of the Schaum's Outlines series because it emphasizes examples and exercises. I have only used them for mathematics and physics subjects, but from the reviews, it seems like "Schaum's Outline of Programming with C++" is similar.
 
  • Like
Likes QuantumQuest
  • #3
Just a quick note: C and C++ are very different. Pick one to learn. Not both at the same time. Bad idea.

You can learn enough C in a few months to accomplish a many things. C++ has the STL, which takes a long time to learn. And this is a primary reason why the two languages take very different approaches to solving the same problem.
 
  • Like
Likes QuantumQuest
  • #4
Avatrin said:
I often find it quite frustrating to learn a programming language through a book; I always find myself skipping through huge parts of the book I have to read before moving onto the exercises. That was the main reason I did not ace my Python exam at university; I was told to use syntax I hadn't even seen until exam. I had done most of the exercises, but apparently not the right ones.

It maybe somewhat frustrating to learn from a textbook but this depends on various factors, like how much anyone likes programming so how much he/she is willing to spend time and efforts, how much time he/she has available, in what way he/she learns best and last but not least, if there is some time deadline like preparing for an exam or anything else. Although all these are quite understandable and more or less we've all been through similar conditions, the fact is that you can learn very well from a textbook, throwing enough code tinkering/experimenting and lots of problems and exercises into the mix and based on the procedure think - design - implement, with the design process being the most important, if you want to go way further. Now, you can of course learn by doing like Codecademy you mention but even this way, a textbook is again a precious guide otherwise you won't go anywhere beyond the basics. I would also suggest taking some online class for programming in any language you prefer - many mainstream languages are available, if you have the time to do so. Coursera is a good place to take a look at, edX is another one. I have taken lots of courses in Coursera in the past and I would even point you particularly to Programming Languages taught by the great Dan Grossman (University of Washington), if you want to learn the gist about functional programming concepts in the right way taught by an expert.

FactChecker said:
I have always been a big fan of the Schaum's Outlines series because it emphasizes examples and exercises. I have only used them for mathematics and physics subjects, but from the reviews, it seems like "Schaum's Outline of Programming with C++" is similar.

I like Schaum's Outlines too and I have used Programming with C and Programming with C++ in the past, among others. They're really great in that they give the essential outline of the main concepts and have lots of exercises and problems, so I highly recommend them too.

jim mcnamara said:
Just a quick note: C and C++ are very different. Pick one to learn. Not both at the same time. Bad idea.

You can learn enough C in a few months to accomplish a many things. C++ has the STL, which takes a long time to learn. And this is a primary reason why the two languages take very different approaches to solving the same problem.

I also highly agree with what jim mcnamara says. Although not necessary to learn C first and then C++, it is good to do so if you want to get in the world of the C family of languages the right way. When you reach the point of good grasping of pointers and dynamic allocation of memory in general and some complex data structures, you can migrate to the C++ monster ?:)- talked in a good sense:wink:.
 
Last edited:
  • Like
Likes Avatrin and FactChecker
  • #5
Last edited by a moderator:
  • #6
http://publications.gbdirect.co.uk/c_book/
The explanations are good, and not too long. I think it has a good structure.

You can find an even shorter intro to C here: http://cslibrary.stanford.edu/ ("Essential C") it doesn't have exercises though (use the book above for exercises?).
What is even more interesting is the "pointers and memory" pdf, I think it's really good.

Advice from someone who had both C and C++ courses: start with C, learn about object oriented programming, then start with C++, at least that worked for me.

I hope these resources will help you!
 
  • #7
Avatrin said:
I often find it quite frustrating to learn a programming language through a book; I always find myself skipping through huge parts of the book I have to read before moving onto the exercises. That was the main reason I did not ace my Python exam at university; I was told to use syntax I hadn't even seen until exam. I had done most of the exercises, but apparently not the right ones.

However, I am quite fond of websites like Codeacademy; You get a bite-sized text to read before you are told to use it in an exercise. However, it does not go very in-depth. Also, it does not cover C or C++.

Are there books or other resources that are structured like that? This question is about C and C++.
From C, many programmers either move on to Java or C++. By learning C first, programmers can become acclimated to the procedural side of the language and then learn object-oriented programming through C++. C++ is more complicated thanC and can be overwhelming for a beginner.
 
Last edited by a moderator:
  • Like
Likes FactChecker

1. What is the best way to learn C/C++ through exercises?

The best way to learn C/C++ through exercises is to start with a basic understanding of the language's syntax and then gradually build upon that by completing a variety of exercises. It's important to challenge yourself with exercises that cover a range of topics, such as data types, control structures, and functions.

2. How do I know if I am ready for more advanced exercises?

You will know you are ready for more advanced exercises when you feel comfortable with the basic concepts and can successfully complete exercises without needing to constantly refer back to tutorials or resources. Additionally, you can try tackling exercises that cover more complex topics or require you to use multiple concepts together.

3. Where can I find exercises to practice C/C++?

There are many resources available online for C/C++ exercises, such as coding challenge websites, online tutorials, and coding forums. You can also find books and practice exercises in textbooks or through online learning platforms.

4. Is it necessary to complete every exercise?

No, it is not necessary to complete every exercise. It's more important to focus on understanding the concepts and being able to apply them to different scenarios rather than completing a certain number of exercises. However, it's always beneficial to challenge yourself with a variety of exercises to improve your skills.

5. How can I track my progress while learning C/C++ through exercises?

One way to track your progress is to keep a log of the exercises you have completed and the concepts they cover. This will allow you to see which areas you have improved in and which areas you may need to review. You can also set goals for yourself, such as completing a certain number of exercises per week or mastering a specific concept.

Similar threads

  • Programming and Computer Science
2
Replies
69
Views
4K
  • STEM Academic Advising
Replies
3
Views
860
  • Programming and Computer Science
Replies
8
Views
971
  • Programming and Computer Science
Replies
1
Views
1K
  • Science and Math Textbooks
Replies
16
Views
1K
  • Programming and Computer Science
Replies
31
Views
2K
Replies
6
Views
1K
  • Programming and Computer Science
Replies
5
Views
878
Replies
4
Views
997
  • Programming and Computer Science
Replies
5
Views
5K
Back
Top