6

I’m finally getting used to C and my brain doesn’t like it lol. Finished a problem set in like 30 minutes but now my mind is trying to process command line arguments in main and it’s just 🤷. like how can it take anything without just dying?? it’s defined as a string, but it can be a number without dying??

Comments
  • 3
    In c when you say "type" what you really mean is "size of data block starting at $var_name"
  • 7
    When you use C, you can't just throw around stuff, you have to understand how it's represented in memory.

    CLI arguments are an argv array of strings whose length is argc, and if you give a number as CLI argument, it's still a string and has to be converted into a number in the code.

    @yellow-dog Well nearly, but there's also automatic alignment as feature - and aliasing as performance booster, but also as lurking undefined behaviour.
Add Comment