Understanding the Null Pointers

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 พ.ย. 2024

ความคิดเห็น • 62

  • @safimsallam6366
    @safimsallam6366 4 ปีที่แล้ว +21

    Excellent course, better than any University !! the whole c programming in one course , amazing .. recommended for beginners and advanced also

  • @vaibhavpandey5851
    @vaibhavpandey5851 2 ปีที่แล้ว +11

    This channel is a blessing for all engineering students ❤️

  • @istutirajeev
    @istutirajeev 3 ปีที่แล้ว +4

    A great learning channel....Its like a boon for me....Thankyou so much for working so hard.

  • @VishalYadav-ss4qv
    @VishalYadav-ss4qv 4 ปีที่แล้ว +14

    Excellent teacher you're sir ji🙏🙏🙏❤️❤️

  • @BCGMCS
    @BCGMCS 8 หลายเดือนก่อน +1

    Additional points
    1.null pointer is a pointer which points to the memory.where that memory is allocated to OS. We can't assign a memory to already reserved memory for OS. So why it's called null pointer
    2.The size of pointer depends on compiler. Which means if the compiler use 16 bit address line then size of pointer is 2bytes like turbo c .if compiler use 32bit address line then the size of pointer is 4 bytes like gcc or if it use 64 bit address line the size of it is 8 bytes like morden gcc. So the size of pointer is only depends on address line of compiler not depends on anything else.

  • @sandhyagowdu9667
    @sandhyagowdu9667 3 ปีที่แล้ว +2

    Sir ur my best teacher in life because I feel fail this subject by u I got confidence

  • @kunalsoni7681
    @kunalsoni7681 4 ปีที่แล้ว +4

    Very helpful video about NULL pointer 😇

  • @xpenguin7378
    @xpenguin7378 4 ปีที่แล้ว +7

    Best explanation on youtube let me tell you

  • @TONY-kq6tf
    @TONY-kq6tf 4 ปีที่แล้ว +2

    Nice..need more topics of data Structure

  • @choonghuh
    @choonghuh 4 ปีที่แล้ว +14

    this is great let me tell you

  • @hackerspot
    @hackerspot ปีที่แล้ว

    The best explanation ever for real

  • @cangorkemgunes
    @cangorkemgunes 4 ปีที่แล้ว +2

    Thanks

  • @rishabh6051
    @rishabh6051 4 ปีที่แล้ว +2

    very helped

  • @kajalmondal9745
    @kajalmondal9745 4 ปีที่แล้ว +1

    Great explained .....

  • @yashbhinwal2801
    @yashbhinwal2801 3 ปีที่แล้ว +1

    very good....I mean what a lecture 👍🏻

  • @HelloWorld40408
    @HelloWorld40408 ปีที่แล้ว

    thank you sir

  • @Red-g1f
    @Red-g1f 4 ปีที่แล้ว +1

    Please upload the whole course as soon as possible please sir 🙏🙏🙏🙏🙏🙏

  • @johnsknows3135
    @johnsknows3135 ปีที่แล้ว

    thx bro!

  • @sagarlodhiya5537
    @sagarlodhiya5537 4 ปีที่แล้ว +3

    Difference between Null pointer and Dangling pointer??? by looking at the definition, it's seems to be same.

    • @rithikamurali2000
      @rithikamurali2000 4 ปีที่แล้ว +10

      NULL pointer points to nothing whereas Dangling pointer points to non-existing memory (here is an analogy, if u have an empty chips packet then its Dangling pointer whereas if u don't even have a chips packet then its null pointer)

    • @chancertravels
      @chancertravels ปีที่แล้ว +1

      ^^yes. Dangling pointer points to a memory address that previously existed, and now does not. Hence it will lead to unpredictable runtime results if dereferenced. This is very, very bad. NULL pointer, is a pointer that points to NULL (technically, the 0 address or “invalid” address in code). This address does not store variables or data of any kind.

  • @ThePirrg
    @ThePirrg 2 ปีที่แล้ว

    i love this guy let me tell you

  • @48_prasenjitmondal6
    @48_prasenjitmondal6 4 ปีที่แล้ว +2

    Exclusive video

  • @madhurbhatia2390
    @madhurbhatia2390 3 ปีที่แล้ว

    Excellent

  • @arunkumar-xu8nr
    @arunkumar-xu8nr 4 ปีที่แล้ว +1

    Hi sir plz upload all the videos soon plz plz,my humble request

  • @sahilkrshah6399
    @sahilkrshah6399 3 ปีที่แล้ว

    ThankYou Sir!

  • @DINO5551000
    @DINO5551000 ปีที่แล้ว

    Is it not incorrect to say that it doesn't point to any memory location since if you look at the memory layout of an operating system a null pointer would be the area beneath the Text/Code segment? Wouldn't it be more correct to say "which points to an invalid memory location" ?

    • @kabil6164
      @kabil6164 ปีที่แล้ว

      Yes, it points to the address 0 which is the very first address of the memory

  • @srikarrepaka5023
    @srikarrepaka5023 3 ปีที่แล้ว +1

    0:47
    1:12
    2:10
    3:05
    3:29

  • @harsh9558
    @harsh9558 3 ปีที่แล้ว

    Thx

  • @harshitachaurasia1246
    @harshitachaurasia1246 4 ปีที่แล้ว

    amazing

  • @wardaddy5562
    @wardaddy5562 4 ปีที่แล้ว

    Thnq sir

  • @MissTweenn
    @MissTweenn 2 ปีที่แล้ว

    Why should you do a null check before dereferencing a pointer, if it’s null isn’t it going to dereference to 0 anyways

  • @nagababuveeranki5429
    @nagababuveeranki5429 3 ปีที่แล้ว

    What is null pointer assignment error in c?

  • @hrishikeshkashyap3715
    @hrishikeshkashyap3715 4 หลายเดือนก่อน +1

    At 2:43, suppose we declare "ptr" as a void pointer.... Then also, we have to typecast "ptr" to get 0 as output without getting errors?????
    For example:
    int main() {
    void *ptr=NULL;
    printf("%d", (int*)ptr);
    return 0;
    }
    👆 Like this????

  • @sameerkaushik537
    @sameerkaushik537 4 ปีที่แล้ว

    Upload daily sir

  • @anonym_3241
    @anonym_3241 11 หลายเดือนก่อน

    Who can explain me what are the differences of below snippet
    Ptr == NULL
    *Ptr == \0

  • @totsh2056
    @totsh2056 2 ปีที่แล้ว

    When I try to initialise a pointer to NULL i get this error: ‘NULL’ undeclared (first use in this function)

  • @devDarshilJadav
    @devDarshilJadav 4 ปีที่แล้ว

    why there is no * in fact 1 while printing the pointer.

  • @priyankalogasundar
    @priyankalogasundar 3 ปีที่แล้ว +1

    Can any body explain what is null check

    • @VishnuIITMadras96
      @VishnuIITMadras96 2 ปีที่แล้ว

      It's Checking , whether that certain pointer was null, in other words, The memory can access is 0, So no more space.

    • @chancertravels
      @chancertravels ปีที่แล้ว

      Like the above, in the case of heap memory allocation, should a malloc or realloc call fail, they will return a NULL pointer instead. So it is good industry practice to check if this returned pointer, to a temporary variable, is NULL; and only if not NULL you may reassign your pointer location to it. Hence to keep the integrity of the data/program. It is rare, though possible, for heap memory to run out-especially in code outside of practice or isolated/protected/separated sessions.

  • @TakoGod69
    @TakoGod69 หลายเดือนก่อน

    the way he pronounced "a null" is very funny

  • @akaashtripathi468
    @akaashtripathi468 ปีที่แล้ว

    2:59 there is segmentation fault in vscode

    • @bhatmehran2116
      @bhatmehran2116 ปีที่แล้ว

      Because it’s dangerous to assign value to an uninitialised pointer ( Segmentation Fault)

    • @chancertravels
      @chancertravels ปีที่แล้ว

      Yeah when you (try to) manipulate data extraneous to the area that you should access. You’re not allowed. Hence seg fault.

  • @firstnamelastname3532
    @firstnamelastname3532 3 ปีที่แล้ว +4

    1:42 *ptr=NULL;
    should be correct during initialization.

    • @patrykrborodo9322
      @patrykrborodo9322 2 ปีที่แล้ว +1

      Malloc returns NULL when there is no more memory available, so this is correct

  • @HopeNHopes
    @HopeNHopes 6 หลายเดือนก่อน

  • @ObsishOroMan
    @ObsishOroMan 9 หลายเดือนก่อน

    🎉

  • @beypazariofficial
    @beypazariofficial 3 ปีที่แล้ว

    in an integer array, i want to use null to avoid getting out of range of the array. but i can't use it. because for example, i created an array has 12 members. so the first index is 0 and the last index is 11. when it's getting out of range, for example arr[12] is existing. you can try it. it gives random numbers every time i run the program. so null is not suitable in this case.

    • @martiananomaly
      @martiananomaly 2 ปีที่แล้ว +1

      arr[12] is giving you random numbers as it's containing garbage data as your array hasn't been allocated that memory chunk.

    • @chancertravels
      @chancertravels ปีที่แล้ว

      ^^ it’s accessing memory outside of its semantically restricted area.

  • @usmanalyassirajuddeen
    @usmanalyassirajuddeen 3 ปีที่แล้ว +1

    Saaray paisay LET ME TELL YOU kay hain, otherwise best explaination veeray..

  • @dineshchintu9779
    @dineshchintu9779 3 ปีที่แล้ว

    how can u explain with malloc func as we dont know that topic

  • @PierangelimaLopez-sf9mi
    @PierangelimaLopez-sf9mi 3 ปีที่แล้ว

    im really need this for sims 3 download im keep get a error im download

  • @usefullyuseless4404
    @usefullyuseless4404 3 ปีที่แล้ว +1

    dont repeat every line... its annoying, ...you could've explain this in mere 2 minutes...

    • @harshalkumar4538
      @harshalkumar4538 3 ปีที่แล้ว

      iddis waddis

    • @hetaeramancer
      @hetaeramancer 3 ปีที่แล้ว +1

      That would've been more confusing and fast!

    • @kaus05
      @kaus05 3 ปีที่แล้ว

      Watch it at 1.5x then

  • @nikhil5062
    @nikhil5062 4 ปีที่แล้ว

    👎