What is a C++ null pointer? ⛔

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

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

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

    #include
    int main()
    {
    int *pointer = nullptr;
    int x = 123;
    pointer = &x;
    if(pointer == nullptr){
    std::cout

  • @mikmik3965
    @mikmik3965 9 месяцев назад +24

    i dereferenced an unassigned pointer once, now im homeless

  • @CorneliusCorndogJr
    @CorneliusCorndogJr Год назад +14

    the blow up was so unexpected lol

  • @juanmacias5922
    @juanmacias5922 4 месяца назад +12

    CrowStrike should have watched this video. LOL

  • @lalilulelo93
    @lalilulelo93 5 месяцев назад

    Excelent video as always. I hope you teach us more about C++ in the future!

  • @Anonymous-st1vk
    @Anonymous-st1vk 2 месяца назад

    Never new a word as perfect as NULL existed for me

  • @Vincent45678
    @Vincent45678 Год назад +3

    I wanna try. Will there be any problem If I try it on my lappy

  • @FrederikWollert
    @FrederikWollert 7 месяцев назад +1

    Good Video.

  • @QuetzalcoatlGames
    @QuetzalcoatlGames 18 дней назад

    I deeferenced an unassigned pointer in an UE project... what project? 😅

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

    if i assign NULL to the pointer while declaring it, will it work the same as nullptr or there will be a difference ?

    • @Coding-With-Joseph
      @Coding-With-Joseph 12 дней назад

      Using NULL and nullptr in C++ is similar but not exactly the same:
      What is NULL?
      NULL is just 0 in disguise. It's not specifically for pointers, so it can cause confusion in some cases.
      What is nullptr?
      nullptr is designed only for pointers. It’s safer and easier for the compiler to understand.
      Why use nullptr?
      If you use NULL, the compiler might get confused between numbers and pointers.
      Use nullptr in modern C++ because it’s safer and avoids mistakes.

  • @chatGPT-ni7gx
    @chatGPT-ni7gx 6 месяцев назад +1

    AD HƯỚNG DẪN VỀ CẤU TRÚC DỮ LIỆU VÀ GIẢI THUẬT ĐI

    • @khoanguyen-px5yc
      @khoanguyen-px5yc 6 месяцев назад +1

      noi tieng viet sao ma no hieu ba

    • @chatGPT-ni7gx
      @chatGPT-ni7gx 6 месяцев назад

      @@khoanguyen-px5yc sử dụng PC sẽ hiểu

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

    Bro I wanna try it, but will it actually blow up my computer?

    • @adamkherbek586
      @adamkherbek586 Год назад +6

      Bruuuh ...It did nothing it just returned a value of 3221225477 instead of 0 and took 3 seconds to execute

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

      lmao🤣🤣🤣

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

      @@adamkherbek586 imagine you did this for the big projects🤣🤣🤣

    • @gwihsanz431
      @gwihsanz431 11 месяцев назад +1

      😅😅

    • @avxqt001
      @avxqt001 6 месяцев назад

      It showed me Permission denied error

  • @ferdinand1975
    @ferdinand1975 15 дней назад

    can someone give me a spoiler of what would really happen if i deference a nullptr

  • @AaronPereira-k3r
    @AaronPereira-k3r Месяц назад

    Todays lesson: never outputs nullptrs or else...