Added: 1 year ago
From: miprabasiva
Views: 11,694
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (14)

Sign In or Sign Up now to post a comment!
  • This video is harmful. The code is totally wrong w.r.t. several points:

    - Casting the result of malloc is useless.

    - Allocated structs are of the wrong size.

    - It is a miracle that its ultimate for works, the last pointer is not guaranteed to be NULL.

    I was surprised as hell that his code actually does what he expected.

    Please do not use youtube to learn programming, buy K&R.

  • Although the code is working, is has a severe and subtle problem: when allocating memory for a node, a wrong size is used, sizeof struct node *, which is 4 bytes (the size of a pointer).

    The structure node itself is larger than 4 bytes, so when an element is created and initialized, the heap is corrupted. The program works because the memory is leaked (no free is performed), but in a serious application, this bug would create crashes and would be nearly impossible to find.

  • after the first for loop add

    (clist--)->ptr= NULL;

    to make the code work

  • very simple and well made video.

  • it would be great if you could explain your code also ... i mean like step wise how it works ... it would help me very much to understand how linked list works ...

    thanks

  • i made a solution for it ...

    put flag at the end of your program if you have a problem..

    that is in a last for loop; flag++

    then put if(flag==10) {  break; } so temprorary solution but for now that's all i can do :D

    thanks a lot i understood this topic because of you...

  • thanks for your help but last code is not working :D thanks a lot

  • audio is too low -.-", and need some more explanation with this pgr.

  • this program doesnt run not sure why

  • improve the voice sir

  • decent video - you should try elaborating on key points like the importance of pointers and what malloc does and when it should be use. You have a clear voice but you should speak up a bit :) I'd look forward to more tutorials from you.

    btw...cshell on a mac..ugh made me cringe :( lol!

  • SHUTUP!

  • Comment removed

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more