what is the best way to learn C ? I know basic python but would like to learn C, I tried searching online but couldn’t find a good resource that’s good for a beginner like me. any suggestions ?

    • Square Singer@feddit.de
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      1 year ago

      Tbh, A-B-problems are something super common in IT. So much time is wasted by going down the wrong road because someone comes to you with the apparent solution that they thought of, instead of just posing the problem they want a solution to.

      In case of this post, there are quite a few reasons why the OP wants to learn C after learning a bit of Python, and some of them have C as the correct solution, some don’t.

      For example:

      • OP wants to make C-modules for Python -> C is the correct language, though Google might already have a fitting module
      • OP heard that Python is slow and C is fast -> Improve your Python skills, learn algorithmics
      • OP has a legitimate problem to solve where Python is not fast enough -> Check out Java/C#/Rust or, if it really has to be, C++
      • OP wants to program microcontrollers -> C is good, but might want to check out MicroPython
      • OP wants to program games -> Unity + C#
      • OP wants to go real low level -> C
      • OP is a masochist -> C or Assembly

      Especially the “C is faster” argument is often a trap for new programmers, since C is only faster if you really know what you are doing. C can also be much slower if e.g. you mess up memory management. Or, more common, C is not at all, because the rookie programmer gets stuck at arcane error messages that they can’t fix.

      In most cases the pure execution speed is not what is limiting the performance, but instead the algorithms and data structures used. For example, if you loop through a large array to find an entry it doesn’t matter that the looping is 4x the speed, when you could also just use a hashmap/hashset, which will be orders of magnitude faster.