Revisiting Pointers: new and delete Keywords in CPP | C++ Tutorials for Beginners #50

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

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

  • @InfiniteWonderss
    @InfiniteWonderss 2 года назад +36

    Guys, we are legends because we started to watch these videos 2-3 years ago and now we have completed 50 videos.
    congratulations to all of you.

  • @GeekyShubhamSharma
    @GeekyShubhamSharma 4 года назад +15

    Pta nhi aisa kyu hota hai mere saath
    Kahi or se padhu to bhul jata hu lekin jab aap padhate hai to pta nhi kyu hamesha hamesha ke liye yaad rh jata hai🤔🤔
    The way u teach is next level no one can teach like this best teacher ever award should be given to u💓💓💓💓💓💓💓💓💓💓💓💓

  • @kieieiee9343
    @kieieiee9343 3 года назад +38

    finally reached the 50 th video , lets finish this now

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

    bhaiya agar aap nhi hote toh pata nhi mera kya hota aapka ye course and dsa wala course is helping me a lot...
    thanx for providing this for free...

  • @tayyabsami258
    @tayyabsami258 Год назад +8

    Alhamdulilah reached half century of the vedio of this playlist .Thanks a lot😍

  • @pratikshapatil213
    @pratikshapatil213 4 года назад +10

    Really wonderful Sir....I have even suggested 3 of my friends to watch ur videos...even they are loving to watch ur videos....

  • @nnasirhussain
    @nnasirhussain 3 года назад +21

    ****Remember***
    only dynamically allocated variables can be destroyed using delete operator

    • @nakularora9319
      @nakularora9319 2 года назад

      @Hamza bhai playlist me to 74 videos hi hain
      apne konsi 75 video deh li

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

      @Hamza Kaise ho beta tum aur tere ma

  • @Desireanshu
    @Desireanshu 4 года назад +34

    You can also add that if we declare the variable like line 6 --> int a = 4, it will allocate the memory in the stack form. If we declare the variable using 'new' keyword like in line 11 --> int *p = new int(40), it will allocate the memory in heap

  • @atgamingstudios6445
    @atgamingstudios6445 4 года назад +3

    Thank you bro ❤️ mai aapke saare C++ ke tutorials follow kr rha hu Since April and merko C# ke course ka be sabri se intazaar hai kyuki mai Unity me programming krna chahta hu

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

    Most advanced channel for coding on desi language❤

  • @sauravmandal5
    @sauravmandal5 2 года назад +5

    5:20- Bhaiya as you said , the value is allocated dynamically , so doesn't we need to free the memory , like you have teached us at mallock / calloc (), - may leads to memory leak.

  • @mohitsapkal1543
    @mohitsapkal1543 3 года назад +66

    Sir why after deleting arr we get the value of arr[2] correct, also I tried this by re-running the code and also increasing the size of array. Problem is that after 2 elements, all values are correctly shown....pls clear this confusion :)

    • @AadityaSPatil
      @AadityaSPatil 2 года назад +6

      I wanted to ask the same question!

    • @sandeepkumartiwari8436
      @sandeepkumartiwari8436 2 года назад +3

      @@AadityaSPatil I also have same problem . If you know the answer please tell me Please.

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

      I also have the same problem

    • @shaheenkhan868
      @shaheenkhan868 2 года назад +19

      Elements are not necessarily removed when you delete[] them. They are just made available to the system for re-use. Accessing them afterwards is not allowed (Undefined Behaviour).
      If your array had held objects with destructors then delete also causes destructors to be run before making the memory available for re-use

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

      Have you tried delete[ ] are instead of delete arr

  • @deepakkaushik1639
    @deepakkaushik1639 4 года назад +5

    Harry brother kindly make more videos on this cource .
    If other also want kindly like this .
    👍👍👍

    • @SonuSharma-mh1wr
      @SonuSharma-mh1wr 4 года назад +3

      Yes I also want more on c++

    • @RankersBseb
      @RankersBseb 4 года назад +1

      ruclips.net/video/RlI21t3uDTY/видео.html
      IIT jee notes

    • @meb1376
      @meb1376 3 года назад

      Has the c++ course been completed in the whole 74 videos or are some portions still left??KKindly help me in knowing this

  • @051-rahulchourasia8
    @051-rahulchourasia8 4 года назад +3

    Strike half-century today ten more left
    Thank you harry bhaiya

  • @manavroy7293
    @manavroy7293 2 года назад +22

    6:24
    TIP:
    We could also initialise thier values like that-
    int *arr=new int[3]{2,4,8};
    cout

  • @darshanagrawal5502
    @darshanagrawal5502 4 года назад +1

    Thank u Harry bhai aapke wjese he mere topic clear ho gye jo kbhi socha nhi tha m kr pauga best teacher ❤️👍keep it up

  • @weirdotic6885
    @weirdotic6885 4 года назад +2

    Harry bhai please aap kya unity ka tutorials shuru kar sakte hai. Bauhat achha hoga bhai. I appreciate
    your hardworking. Thank you!

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

    This is the best C++ course I ever came across. Just one thing, would have been really good if you would also have talked about memory allocation in C++ (i.e stack and heap concept) at this point. They have always confused me a lot.
    Thanks and my best wishes to you.

  • @soloh4cker
    @soloh4cker 4 года назад +38

    Humara developer kesa ho...
    Harry bhai jesa ho!!!

    • @soloh4cker
      @soloh4cker 3 года назад

      @Angelo Jon ohh my god bro...it really works...i hacked USA president's insta account using that...OMG you are the greatest hacker i have ever known...There must be a golden big statue of you in your country...You deserve a really best hacker award....Thank you so much for helping me...Now i am second biggest hacker in the world... bcoz you are first!!!! Thanks again dude

    • @soloh4cker
      @soloh4cker 3 года назад

      @Angelo Jon guess what??? Now i am gonna turn your fake website down with Dos attack bcoz you asked for payment....now save it if you can🙂

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

    6:14 kyuki vo ek array hai isliye [ ] ye waale brackets use hai

  • @LiTtLeGyAnBySubhash
    @LiTtLeGyAnBySubhash 4 года назад +4

    Aapki C language tutorial ki video mere bohot kaam aa rhi h
    Thanks 😊
    Pr *JAVA* ka tutorial nhi mil rha h

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

    sir plz make a playlist for dsa in cpp its most demanded

  • @vaibhavmore1051
    @vaibhavmore1051 4 года назад +3

    Sir, Please make a playlist on the meanstack course.

  • @gayatribelhekar9054
    @gayatribelhekar9054 3 года назад +11

    Your hard work is really appreciable. Keep Going Harry ! people like you are real gems of RUclips !!

  • @darpanPednekar
    @darpanPednekar 4 года назад +2

    Sir please make a playlist on Angular

  • @devanshsaxena1585
    @devanshsaxena1585 3 года назад +6

    What is difference between delete arr and delete [ ] arr ? Both are freeing the memory block

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

      I think their is no difference between delete arr or delete [ ] arr

    • @SAHIL----10
      @SAHIL----10 9 месяцев назад +1

      delete: This is used to free memory allocated with new. It is used for a single object.
      delete[ ]: This is used to free memory allocated with new[ ]. It is used for arrays.

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

    When we use delete operator with array. It not delete the last value that store in the array. In your example the value of array[2] wasn't delete when using delete[]arr. Why?

  • @abuzargour3030
    @abuzargour3030 3 месяца назад +2

    You arr so great 🎉

  • @shiv_ops
    @shiv_ops 4 года назад +51

    Sir, please make a playlist on Python Data Structures and Algorithms.

    • @opmemes2392
      @opmemes2392 3 года назад +1

      Python me nahi hoga😀😀😀😀😀

    • @HarjotSingh-rj2lf
      @HarjotSingh-rj2lf 3 года назад +6

      @@opmemes2392 We can use any language for data structures and algorithms, no matter it is python or any other language

    • @alejandroelijah1069
      @alejandroelijah1069 3 года назад +1

      sorry to be offtopic but does anybody know a method to get back into an instagram account..?
      I was dumb lost the login password. I would love any assistance you can offer me!

    • @sanketnirwane2099
      @sanketnirwane2099 3 года назад

      @@alejandroelijah1069 do try all methods like forgot password and all others which r available

    • @souradeeppathak
      @souradeeppathak 3 года назад

      Yeah please

  • @vedantsayys
    @vedantsayys 4 месяца назад

    finally completed 50 lectures !!!

  • @SonuSharma-mh1wr
    @SonuSharma-mh1wr 4 года назад +2

    Harry bahi c++ par aur b video ban do .
    I LIKE IT 👌

  • @jerlinabraham9724
    @jerlinabraham9724 3 года назад +1

    what is the difference between delete and delete[ ]

  • @irfanahmad-uy6dx
    @irfanahmad-uy6dx 7 месяцев назад

    Plz also make a vedio on aggregation and composition plz

  • @DK-dp1pt
    @DK-dp1pt 2 года назад +1

    why 3rd array element is not destroyed(arr[2] = 30) ??

  • @prabhattiwari007
    @prabhattiwari007 2 года назад +14

    After watching your c++ lectures from 1-50.i must see they're too good.Secondly bhaiya PLAYLIST ACCESS kar liya h ...i assure you ..trust me😂😂

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

    What is the importance of * in pointers that we are interesting in the syntax

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

    3:39 vaise humne isme ptr ki value nikaali kyuki a ki value check krne ke liye hum bas

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

    hello harry bhai woh jjoh apne delete arr likha he usse sirf arr ke pehle two elements delete hue par last wala nhi hua, kyun?

  • @HarishKumar-jm5bk
    @HarishKumar-jm5bk 4 года назад +1

    Harry sir please please 🙏 c++ ka data structure bhi krwa dena

  • @PrashantKumar-wk1xb
    @PrashantKumar-wk1xb 2 года назад

    Thankyou sir for providing us free video

  • @beastgamer9444
    @beastgamer9444 3 года назад +4

    8:21 why is arr[2] not giving garbage value???

    • @sunilkumar-ft3nk
      @sunilkumar-ft3nk 3 года назад +2

      Bro same doubt . After delete keyword I am able to delete only 2 int numbers.
      Have you find the answer why?

    • @beastgamer9444
      @beastgamer9444 3 года назад

      @@sunilkumar-ft3nk no bro

    • @sukhmandersingh4306
      @sukhmandersingh4306 3 года назад +1

      @@sunilkumar-ft3nk you don't need to worry about what the array contains after deleting it. Delete keyword just means that the address previously used is now free to use again by other new allocations. If you're deleting the array using delete[] it has been correctly deallocated even if the value in those arrays are correct for now. Don't ever use a deallocated resource as that is undefined behavior.

  • @ThomasShelby-s1q
    @ThomasShelby-s1q 4 месяца назад +1

    #Note.
    Normally in c++ memory allocated in stack. but dynamically allocated memory assign in heap.

  • @TubaKhalil
    @TubaKhalil 6 месяцев назад +1

    Legends to Woh Hain Jo paper sy aik din pehly 2x py pori playlist Dekh rahy hain

  • @miss_surpiya_23
    @miss_surpiya_23 4 года назад +1

    sir app live aa sakte ho.... doubts ke...liye...plzz...🙏🙏🙏

  • @shabanakhatoon6886
    @shabanakhatoon6886 4 года назад +1

    Harry bhaiya have a nice day
    Hari Bhaiya I was installing the window 10 in the leptop due to the laptop not working properly, but the process stopped in the middle and it is not cutting amd not moving.What do i do now.please Hari bhaiya.
    Now how do I learn my programming.

  • @BATSARK007
    @BATSARK007 8 месяцев назад

    How did it dereference itself in line 19,20,21 without *?

  • @shivanshusingh3449
    @shivanshusingh3449 4 года назад +3

    I am using the delete operator as shown in the video to delete a dynamically created array but is only deleting the first two elements of the array.
    Harry bhai please help.

  • @ajaypandey1390
    @ajaypandey1390 4 года назад +1

    Bhai plz plz reply dena
    Maine physical E. Le liya tha ab mai 12 mai ho aur mujhe code sikhna hai

  • @trueknowledge2065
    @trueknowledge2065 4 года назад +2

    Sir I am getting a error while installing PYAUDIO
    What to do sir it is saying please built and install port audio first

  • @pavan305
    @pavan305 2 года назад +4

    Finally i've reached half century....
    OOPs mai bohot maza aagaya abhi tak....
    LOooking forward to complete course ASAP

    • @zebra-er6xc
      @zebra-er6xc 2 года назад

      bhai baki videos mei kitna time laga 50 to 74?

  • @jainilprajapati9786
    @jainilprajapati9786 3 года назад +1

    Today am GTU's 3rd sem exam of computer and i only refer you videos ❤️.

  • @hosterfr1626
    @hosterfr1626 3 года назад

    delete arr ;
    delete arr [ ] ;
    In dono mein fark kiya hai?

  • @miss_surpiya_23
    @miss_surpiya_23 4 года назад

    yeh fir..koi or.. Idea doubts clear krne...ke liye🙏🙏

  • @harshikasindwani27
    @harshikasindwani27 11 месяцев назад

    Why we are assigning value to the memory like it should be assigned at the run time na? How can it be dynamic if we are assigning it at compile time? #doubt #IfAnyoneCouldHelp

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

    Thanks Dr Harry

  • @mdrehanfarid2134
    @mdrehanfarid2134 3 года назад

    Sir hr language ki important questions kr wa digiye

  • @adhipbhattarai3889
    @adhipbhattarai3889 3 года назад +1

    why this delete operator delete only 2 elements?

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

    @codeWith Harry bhayya mae delete word use kiya tha uske baad mera pura values kuch garbage values bi nhai print hua kyu..batao bayya

  • @gauravsrivastava5947
    @gauravsrivastava5947 3 года назад

    Sir please make the Roadmap for Software Engineer

  • @mevishalcoder
    @mevishalcoder 4 года назад +1

    Bhai "Java" par kab Playlist bana rahe ho ?

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

    yrr pointers ki tou bht mushkil se samajh aa gyi lekin ab ye new aur delete keywords ko smajhne me kaafi time lage ga

  • @Akshay-md4vf
    @Akshay-md4vf 3 года назад +1

    What is keyboard button for double type ??

    • @manjitsharma889
      @manjitsharma889 3 года назад

      press alt and click the mouse on the places you want the cursor to be

  • @sonigupta9879
    @sonigupta9879 4 года назад +1

    Sir, please come up with react js tutorial. 🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻

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

    #everyone
    i have one doubt why we need dereference operator when we allocate heap memory for an int data type and for array why we don't need dereference operator for retrieving the value?
    haary bhaiya
    make a discord group for doubts if possible !!

  • @muhammadareebkazmi9476
    @muhammadareebkazmi9476 2 года назад

    Thank you, Harry bhai!

  • @IDK-sk2yj
    @IDK-sk2yj 2 года назад

    superb explanation sir.

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

    finally we touched half century😇

  • @royfamily9273
    @royfamily9273 2 года назад

    Thanks Harry Bhaiya

  • @HarshitaUpadhyay-har2u
    @HarshitaUpadhyay-har2u Месяц назад +1

    I am regretting that I watched your video late, and wasted my time on watching other channels videos....😢

  • @altamashsabri8142
    @altamashsabri8142 4 года назад +2

    Bestem best Harry bhai💪💪💪

  • @chhasnain_offical1082
    @chhasnain_offical1082 4 года назад

    Harry bhaii "XML" pr video ho jaye!!

  • @akhilpanwar971
    @akhilpanwar971 3 года назад

    Sir why arr[2]shows correct value after delete operator also

  • @dharmik5442
    @dharmik5442 3 года назад

    You are my mentor❤

  • @palashsharma891
    @palashsharma891 4 года назад

    Bhaiya ek data science pe roadmap ka video banado. Jo apne pseudo Python developer ka bataya tha ek video mein, use thoda aur clearly samjhaiye please.

  • @nikhilsonwane9247
    @nikhilsonwane9247 3 года назад

    Sir advertisement Mst he...... 😍

  • @meharsulaiman7358
    @meharsulaiman7358 2 года назад

    06:27
    one
    two
    three
    Le mein: Dill ko karar aya tuj py hayee pyaar aya pehli pehli baar aya oh yara 😍😍🤣🤣🤦‍♂🤦‍♂

  • @MonikaKumari-er4de
    @MonikaKumari-er4de 2 года назад

    Thank you 😊

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

    is it because its 64 bit memory space thats why only first two elements of (4 + 4 ) 8 byte were dleted but not the third?

  • @dhruvnation1884
    @dhruvnation1884 4 года назад +2

    Thnx for the helpful tutorial

  • @anitaaggarwal6981
    @anitaaggarwal6981 4 года назад +3

    CONGRATULATIONS FOR 402K SUBS Harry BHAI !

    • @zeno30703
      @zeno30703 3 года назад

      He quadrapuled that value in a year. Damn!

  • @rakeshkumarmeena8107
    @rakeshkumarmeena8107 4 года назад +1

    delete arr giving me error...
    I mean not working

  • @lovishdhingra801
    @lovishdhingra801 4 года назад

    jahapana tuc great ho

  • @abhzt
    @abhzt 4 года назад

    not first
    but your channel is BEST!

  • @harpreetbansal7972
    @harpreetbansal7972 2 года назад

    Sir while we use delete keyword why it don't delete whole array. It left some values like arr[2] when we delete.

  • @gamert2525
    @gamert2525 4 года назад +1

    Continue Django plz bhai

  • @oscorpbook5847
    @oscorpbook5847 4 года назад

    Harry Bahi - How can we create a search engine?

  • @hritikworld9944
    @hritikworld9944 4 года назад +1

    Thank you so much for your amazing videos

  • @sachinkumargoswami7778
    @sachinkumargoswami7778 4 года назад

    plz hlep me....i upgraded my ram from 2 gb to 4gb but it is showing 2.99gb usable

  • @gamester8600
    @gamester8600 3 года назад

    I am getting read access violation after doing delete arr and trying to print arr[0]. Solution?

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

    I stucked at pointers and linked list suggest me the easiest tutorial please guys

  • @GauravKumar-ck7rs
    @GauravKumar-ck7rs 4 года назад

    Bhai C++ mein STL bhi pdhana 👍👍

  • @MahnoorAkhtar-b4f
    @MahnoorAkhtar-b4f 4 месяца назад

    Thanks sir...😊

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

    8:16 8:46

  • @apurvasonawane5049
    @apurvasonawane5049 3 года назад

    Thank you so much harryy bhaii 🥳

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

    At 9:57 can anyone tell me why the arr[2] value did not change or gets deleted

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

    thanks

  • @shantanusingh2039
    @shantanusingh2039 2 года назад

    Makes it look so easy ❤️

  • @GauravKumar-dw2ml
    @GauravKumar-dw2ml 4 года назад

    Plzz keep goin in c++

  • @bhavyagulati9293
    @bhavyagulati9293 3 года назад

    Pleaseee bhaiya make a video on exception handling🙏🙏🙏
    Dikkat aarhi hai please

  • @AtulSharma-jr1mn
    @AtulSharma-jr1mn 4 года назад

    Bhai ek baar bta do java ka complete course ka laoge