[–] 2 points 2 months ago (1 child)

Before trying to learn and use the standard library, I'd advise you to write a few simple functions yourself:

  1. void print_until(const char* str, char c) - print every character in str until you see c or null (Note: Don't print the c or null, which should ensure that a str that only contains a \0 doesn't crash.)
  2. const char* print_until_2(const char* str, char c) - as before, but return the pointer to where you found c or null
  3. void print_delimited_by(const char* str, char delimiter, char separator) - use print_until_2 in a while-loop, don't print the delimiter, but do print a separator.

For example, print_delimited_by("1;2;3",';',',') should print 1,2,3.

Finally, void num_delimited_by(const char* str, char del) - like print_delimited_by, but add a number before every output, and use newline as the separator.

These fundamental string exercises will give you a solid foundation for understanding oantby's explanations about the standard library. Note that no memory allocation is necessary.

  • source
  • [–] 13 points 2 months ago

    Didn't his net worth increase by something like 2.2 billion dollars as president? (..so_far.gif..)

    Must be really good at predicting the markets, somehow. He's perhaps not that irrational when you consider his actual priorities (himself and his family), not whatever he is saying (MAGA).

  • source
  • parent
  • context
  • [–] 5 points 3 months ago (6 children)

    I have joked to my wife that our kids are lucky they're so cute so we don't throw them out of the window during a heavy day of misbehavior.

    Obviously we wouldn't ever do that (even if they weren't so cute), so the joke is cathartic and can be funny in the right context.

  • source
  • parent
  • context
  • [–] 2 points 3 months ago* (last edited 3 months ago) (1 child)

    I admit I may be wrong so I asked you to show me an example, since you talk with such certainty.

    In fact this is an open question so nobody knows, even though most of the researchers believe human computation is equal as far as I know.

  • source
  • parent
  • context
  • [–] 1 point 3 months ago (3 children)

    Backwards jumps are equally decidable for turing machines as for humans. Compiler and static code linters can trace through very complicated code and know that it will or will not halt, and optimize or warn based on the result.

    I believe there's nothing special about human computation abilities. Anything that is decidable by a human will be also decidable by a computer.

    Please prove me wrong by showing a counter example.

  • source
  • parent
  • context
  • [–] 1 point 3 months ago (5 children)

    Most of the "undecidable" are only undecidable for a subset of the problem instances, while a vast number of instances can be even trivially decidable. For example in the undecidable halting problem, both you and a computer can trivially deduce that while(true) will not halt. In the same way a computer can deduce that many instances of two pieces of code are semantically equivalent.

    I'd like to see an instance of the problem where a human could decide it and the computer could not.

  • source
  • parent
  • context
  • [–] 3 points 7 months ago (12 children)

    Trump was not ever going to try to stop it, he supports genocide and war crimes. Remember him telling Israel to "finish the job in Gaza"?

    Republican Donald Trump has called US President Joe Biden “a very bad Palestinian” who doesn’t want to help Israel “finish the job” against Hamas in its war on Gaza.

    “He doesn’t want to do it. He’s become like a Palestinian – but they don’t like him because he’s a very bad Palestinian, he’s a weak one,” former president Trump said in the first presidential debate with Biden on Thursday in Atlanta, Georgia.

  • source
  • parent
  • context
  • view more: ‹ prev next ›