C++ variable scope explained 🌎

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

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

  • @BroCodez
    @BroCodez  2 года назад +9

    #include
    int myNum = 3; //global
    void printNum();
    int main()
    {
    int myNum = 1; //local
    printNum();
    std::cout

  • @FrederikWollert
    @FrederikWollert 9 месяцев назад +2

    I really like your C++ series. Keep it up. Please make more C++ Videos. So, let's defeat the RUclips algorithm.

  • @hehefunny9129
    @hehefunny9129 2 года назад +1

    Yu the best ❤️

  • @yahyaarfaoui8526
    @yahyaarfaoui8526 Год назад +5

    std::cout

  • @oximas-oe9vf
    @oximas-oe9vf 2 года назад +3

    what do you mean by " "pollutes" the global namespace " ?

    • @BurninVinyl
      @BurninVinyl 9 месяцев назад +1

      Re-watch about namespace. In C++ global variables can potentially pollute the namespace by making it more difficult to disambiguate between variable names and other entities with the same name. This can lead to code that is harder to read and maintain. It's generally recommended to use namespaces or other scoping mechanisms to avoid this issue.

  • @gamsterilyass2952
    @gamsterilyass2952 7 месяцев назад

    ❤ ❤

  • @Nightmare-bo7xi
    @Nightmare-bo7xi 5 месяцев назад

    so what is printNum and how is it related to myNum

  • @Zoetobe
    @Zoetobe 2 месяца назад

    I’m slowly bro-wing lol

  • @TahaProgrammer
    @TahaProgrammer Год назад

    yo

  • @parpaperchimp
    @parpaperchimp 10 месяцев назад

    #include
    int P =3.14;
    int main(){
    std::cout

  • @wlsedlacek
    @wlsedlacek Год назад +1

    comment = rand(random_comment) % 100;

  • @artemzakharchuk2842
    @artemzakharchuk2842 Год назад +2

    std::cout