C++ Build a Function to find String Length; use of const char * pointer [ ] Syntax for Strings

Поделиться
HTML-код
  • Опубликовано: 5 янв 2025

Комментарии • 3

  • @PretoriousVids
    @PretoriousVids 2 дня назад

    I have never written a line of C++ and may never, but I was randomly suggested this and enjoyed it! Clear and concise, nice work!

  • @TheTrienco
    @TheTrienco 2 дня назад +1

    That relief at around 3min when you point out that the code is horrible. Though unless the point of the exercise was to get the length manually, one issue is that it's just plain C with cout thrown in. To be extra lazy (also using C++23 and println instead of cout), there is no need for raw loops and getting the length of anything.
    for (auto s : str) {
    for (auto c : string_view(s)) println("{}", c);
    println();
    }

    • @TechnoLang
      @TechnoLang  День назад

      Thank you for following. More idiomatic C++ will be introduced gradually, step by step