The same person as Daedskin@lemm.ee and Daedskin@programming.dev

  • 0 Posts
  • 6 Comments
Joined 9 months ago
cake
Cake day: June 26th, 2025

help-circle


  • Like a lot of people mentioned, there’s a few good things you could start with, but C is probably not one of them. At my old job I ran a course for software engineer 2s to go over C, and even they had some struggles with it. If professional engineers struggle with C, it’s maybe not the best starting point. Even C++ might be better, but still adds a lot of complexity that isn’t necessary to know as immediately as the beginning.

    Whenever people ask me where to start, I say python. It gives you a relatively tame taste of environment setup, and can run code very easily and flexibly. Its type system is flexible enough to make a user aware of it, without it being as rigid as C or as vague as javascript. Because there’s enough libraries that are easy to pull in, even a beginner can start building useful programs without having to know how to build something equivalent to those libraries themselves.

    Obviously if you want them to make websites, javascript will be necessary eventually, and isn’t a bad place to start. If you’re going purely for CS knowledge, I do think python is a little better; going from python to JS is probably easier than JS to python.


  • One thing you can do that I find comes up pretty often in C is start using switch statements to avoid code duplication. Because your operators all take 2 numbers, you’ve separated out the input handling into its own block; that alone is a really good insight.
    You can take it another step further by making your print statement also, mostly, one block of code, with the only difference being the operation being preformed. By printing “The” followed by using an if-else block — or, again, preferably a switch statement — to both print the operation text, and compute memory, you can print the remainder of the line the same way for every operation.
    It may seem nitpicky for such a simple program; but the use case of C is for programs which require tight execution and often contain complex, low-level logic. Reducing complexity whenever possible helps make C more readable, as well as signal when the complexity is necessary.



  • Daedskin@lemmy.ziptoGreentext@sh.itjust.worksAnon likes a thing
    link
    fedilink
    arrow-up
    0
    arrow-down
    1
    ·
    9 months ago

    I’ve never been called out as AI for using them; but if I ever am, I have the strategy of knowing the alt code for them (0151). I even know the shortcut in word to insert one — pressing alt-X with your cursor at the end of “2014”. I also have a vscode macro set up that is just an emdash, just in case I’m in a situation where there’s not a way I know to insert one.