Dynamic Memory Allocation in C++ Part 1 | C ++ Tutorial | Mr. Kishore

Sdílet
Vložit
  • čas přidán 29. 08. 2024
  • C ++ Tutorial Videos | Mr. Kishore
    ** For Online Training Registration: goo.gl/r6kJbB ► Call: +91-8179191999
    💡 Also Watch
    C Language Tutorials: goo.gl/qDhJ2r
    Core Java FAQ's: goo.gl/qGh5mA
    Core Java Tutorials: goo.gl/NbaEge
    Java Programming Tutorials by Mr.Hari krishna:
    goo.gl/HThq6H
    Advanced Java Programming Tutorials by Mr.Nataraj:
    goo.gl/1U2Qgy
    Subscribe to our channel and hit the bell 🔔🔔🔔 icon to get video updates.
    💡 Visit Our Websites
    For Classroom Training: nareshit.in/cp...
    For Online Training: nareshit.com/c...
    #JavaCollectionsFramework #Tutorials #Videos #corejava #Quiz #Clanguage
    --------------------------
    💡 About NareshIT:
    "Naresh IT is having 14+ years of experience in software training industry and the best Software Training Institute for online training, classroom training, weekend training, corporate training of Hadoop, Salesforce, AWS, DevOps, Spark, Data Science, Python, Tableau, RPA , Java, C#.NET, ASP.NET, Oracle, Testing Tools, Silver light, Linq, SQL Server, Selenium, Android, iPhone, C Language, C++, PHP and Digital Marketing in USA, Hyderabad, Chennai and Vijayawada, Bangalore India which provides online training across all the locations
    --------------------------
    💡 Our Online Training Features:
    🎈 Training with Real-Time Experts
    🎈 Industry Specific Scenario’s
    🎈 Flexible Timings
    🎈 Soft Copy of Material
    🎈 Share Videos of each and every session.
    --------------------------
    💡 Please write back to us at
    📧 us.training@nareshit.com/ 📧 online@nareshit.com or Call us at the USA: ☎+1404-232-9879 or India: ☎ +918179191999
    --------------------------
    💡 Check The Below Links
    ► For Course Reg: goo.gl/r6kJbB
    ► Subscribe to Our Channel: goo.gl/q9ozyG
    ► Circle us on G+: plus.google.co...
    ► Like us on Facebook: / nareshit
    ► Follow us on Twitter: / nareshitek
    ► Follow us on Linkedin: goo.gl/CRBZ5F
    ► Follow us on Instagram: goo.gl/3UXYK3

Komentáře • 151

  • @NareshIT
    @NareshIT  Před 5 lety +13

    Please Comment, Subscribe and Click Bell🔔🔔🔔 Icon for More Updates. To learn software course from our experts please register here for online training: goo.gl/HIB0wL

    • @venkateshreddy2299
      @venkateshreddy2299 Před 4 lety +1

      add Using namespace std before main function and delete array using delete [] a;

    • @terrellantonio5319
      @terrellantonio5319 Před 3 lety

      Sorry to be offtopic but does someone know a method to get back into an Instagram account??
      I somehow forgot my account password. I would appreciate any assistance you can give me!

  • @mussieteshome8397
    @mussieteshome8397 Před 6 lety +81

    This tutorial is Unique. because it begins with "why do we need dynamic memory allocation?" Respect!

  • @zabiamiri7
    @zabiamiri7 Před 4 lety +26

    love the way you explain everything, thank you, sir, from California ..

  • @husseinal-faiz1533
    @husseinal-faiz1533 Před 4 lety +9

    I have my exam this Monday and today I finally understand how dynamic memory works. Thank you for this comprehensible tutorial guru 🙏🏻.

  • @yurijmx6437
    @yurijmx6437 Před 7 lety +39

    you should use "delete [] a;" instead of "delete a;", (in arrays)
    otherwise it will not release all allocated memory.
    example:
    int n = 3;
    int * a = new int[n];
    //......
    delete [] a;

  • @dwaynerock5520
    @dwaynerock5520 Před 3 lety +4

    Just one word to describe this video
    Wow!!!!!
    I have seen number of videos on this topic but none of them get in my head finally i found this amazing video which really tells what is going on in a simple manner
    Once again thank u

  • @ajmalbangash6928
    @ajmalbangash6928 Před 4 lety +9

    Great Lectures by Uuh Sir 😍
    Pakistani professors are not doing it for us. So shamefull 😓😓😓

    • @ajmalbangash6928
      @ajmalbangash6928 Před 4 lety

      @Sana Mahnoor yeah offcourse they are matchless but here i am talking about the CZcams channels they are not doing this

    • @abhineelnandi9552
      @abhineelnandi9552 Před 3 lety +2

      @@yashrsd TMKB

  • @rahilumar3002
    @rahilumar3002 Před 6 lety +7

    Finally after enough struggle i understood DMA
    Thank you so much sir

  • @tejagowtham3856
    @tejagowtham3856 Před 3 lety +1

    @20:57 it is *(p+i) because we want to store the value and the (p+i) states it is pointing to that address, therefore it is *(p+i) not (p+i).

  • @achalchawhan4892
    @achalchawhan4892 Před 4 lety +3

    No one has made dma as simple as u made .. thank u sir... for this expalnation

  • @53_nikhilchoudhary68
    @53_nikhilchoudhary68 Před 4 lety +3

    Sorry sir .....but in previous video we studied manipulators not static memory allocation ...where is the video of static memory allocation...??

    • @SHIVANAN2010
      @SHIVANAN2010 Před 3 lety +1

      Sir was high i guess

    • @ashamach
      @ashamach Před 2 lety

      yes we cant find the video of static memory allocation

  • @shamparoy5394
    @shamparoy5394 Před 4 lety +9

    Where is d video for static memory allocation..plzz rply

  • @sauravghosh7487
    @sauravghosh7487 Před 2 lety +1

    Sir, your lectures are best resources for digital India. Thank you .

  • @Dida2080
    @Dida2080 Před 7 lety +3

    You are the best c++ prof ever......

  • @karanvyas3968
    @karanvyas3968 Před 5 lety

    It also works except for the memory cannot be deallocated.
    int n;
    cout > n;
    int arr[n];
    cout

  • @vsarts1967
    @vsarts1967 Před 4 lety +2

    You are the best sir!.love ur teaching

  • @sapnilpatel1645
    @sapnilpatel1645 Před 3 lety +1

    Thank you sir for knowledge. Its great explanation about dynamic memory allocation.

  • @MANISHKUMAR-ei2ng
    @MANISHKUMAR-ei2ng Před 4 lety +2

    #Naresh i Technologies ... It should be *(p+i) for both cin and cout.

  • @princenegi7000
    @princenegi7000 Před 3 lety +2

    Sir static memory allocation is not there in the playlist
    Please reload the video

  • @saikiranravipati7351
    @saikiranravipati7351 Před 4 lety +1

    Kishore sir was explained C++ very good 👌👌👌

  • @abhishekmohanty232
    @abhishekmohanty232 Před 5 lety +2

    //i think that dynamic memory allocation can be done without pointer and new function
    //just take a look at this program
    //do correct me if i am wrong
    #include
    using namespace std;
    int main()
    {
    int n;
    coutn;
    int a[n];
    for(int q=0;q>a[q];
    }
    for(int q=0;q

    • @nandhannandhan8155
      @nandhannandhan8155 Před 5 lety

      You didn't use dynamic memory, it has to use new to create dynamic memory else it will stack memory.

    • @ritwikreddy5670
      @ritwikreddy5670 Před 5 lety

      U allocated static memory

  • @lokesh1058
    @lokesh1058 Před 6 lety +3

    sir ur institute is dng great pls upload the videos on networking also...

  • @akshaymore3944
    @akshaymore3944 Před 7 lety

    sir , i'm u r student, and i like u r teaching so much.....sir, plz upload all videos of c++ (i.e arrays,inheitance, pollymorphism videos) as possible as fastly.............mi and my all friends are waiting to watch u r remaining videos.............plz, clear the conept of linked list , functions and inheritance .....with daily life examples.........and sir i'm so much happy whenever i was see u on you tube.........sir, provide all videos fastly..........

  • @maheshgodage5683
    @maheshgodage5683 Před 3 lety +2

    Sir
    Then why it showing that variables value after calling delete
    #include
    using namespace std;
    int main()
    { int n,i,j;
    cout

  • @zynkana
    @zynkana Před 5 lety +2

    Thank you very much for your detailed explanation. this program, I have tried on vs2012. It's only printing r*c value. After that it's not giving the remaining couts.

  • @saipavirala7762
    @saipavirala7762 Před 4 lety +1

    Thank u sir it is very help me

  • @arunlabana5937
    @arunlabana5937 Před 3 lety +1

    Sir when u are putting in values u need to write cin>>*(p+i) instead of cin>>(p+i).

  • @57-ajityadav46
    @57-ajityadav46 Před 4 měsíci

    Nice explain sir love it

  • @Suniyedekhiye
    @Suniyedekhiye Před 5 lety +2

    Great teaching Sir thank you so much Sir 🙏🙏🙏🙏🙏🙏🙏🙏

  • @kennyola5481
    @kennyola5481 Před 6 lety +3

    forget the [ ] when deleting the dynamically allocated memory or is it not needed that is
    delete [ ] p;

  • @kiranvinith7106
    @kiranvinith7106 Před 4 lety +1

    Sir
    mind flowing ,
    extradinary ,
    Fantastic......
    I like your way of teaching my college teachers are waste but you are only one best way of teaching
    KISHORE SIR
    😍

  • @lallza3463
    @lallza3463 Před rokem

    This man should taught all the subjects

  • @zorosick4632
    @zorosick4632 Před 3 lety

    Thank you very much. Best video on this concept so far from what I could find

  • @kunalchaudhary2808
    @kunalchaudhary2808 Před 2 lety

    Here you forgot to add * in (p+i) while taking input in array. Your video was good.

  • @swapnilpatil6397
    @swapnilpatil6397 Před 4 lety +1

    Please write delete [ ] P;. To release memory

  • @kmallikarjun186
    @kmallikarjun186 Před 4 lety +2

    while allocating memory, ex: 65500, next address will be 65502, 504,.. so on. not 512,514... for 16 bit compiler.

    • @lakshmiprasannaswarna6750
      @lakshmiprasannaswarna6750 Před 2 lety

      Hi i have one doubt new int(3) will it allocate memory of 6 bytes or the value 3 will store in that memory of int.. If possible can you please reply

    • @lakshmiprasannaswarna6750
      @lakshmiprasannaswarna6750 Před 2 lety

      I got confused by this video.. Sorry to say this..

  • @ajmalbangash6928
    @ajmalbangash6928 Před 4 lety +2

    Love from Pakistan dear Sir ❤❤😍😍❤❤

  • @shinchanandcartoons8536
    @shinchanandcartoons8536 Před 4 lety +1

    Sir plz uploads all videos some videos u have skipped

  • @janhavipatil4971
    @janhavipatil4971 Před 2 lety

    Thank you so much for such clear and excellent explaination!

  • @arun_9342
    @arun_9342 Před 6 měsíci

    Thank you sir

  • @atulsoam472
    @atulsoam472 Před 2 lety +1

    thanks sir totaly got it sir

  • @gauravraj4507
    @gauravraj4507 Před 3 lety +2

    Sir plz upload video in order.. otherwise it is of no use to us, and we have to compormise it from other youtube channel which we dont want .

  • @manilavaswani154
    @manilavaswani154 Před 4 lety +2

    Sir your explaination is amazing..😊,
    Sir i am having a doubt that when i am using cin>>(p+i) it is giving an error but cin>>p[i] is running fine, but why cin>>(p+i); giving an error??

    • @aaminaminur4413
      @aaminaminur4413 Před 4 lety +3

      please try: *(p+i)

    • @maheshshirsat9075
      @maheshshirsat9075 Před 4 lety

      @@aaminaminur4413 but *(P+i) is used for printing actual value stored in pointer.But she want to store value....

    • @softwarefoodiee
      @softwarefoodiee Před 4 lety

      @@maheshshirsat9075 if you use cin>>
      *(p+i) you can store the value....inside a for loop

    • @ajazamin9843
      @ajazamin9843 Před 3 lety

      This is definitely gone print error as we had declared an array but we haven't entered and scanned the array values. This is going to print some garbage value

  • @varunbakshi5625
    @varunbakshi5625 Před 5 lety

    Excellent teaching
    Plz upload more tutorials of c++

  • @rahulchaubey8988
    @rahulchaubey8988 Před 6 lety

    sir you are a very good cpp teacher.

  • @rahulkumar6201
    @rahulkumar6201 Před 4 lety

    Love the way you teaching..

  • @nikhilajyothipenta9391
    @nikhilajyothipenta9391 Před 7 lety +1

    Sir please upload all videos of features of c++

  • @addtef4923
    @addtef4923 Před 3 lety

    Thanks so much. Well explained.

  • @mukulrana1616
    @mukulrana1616 Před 3 lety

    Great explanation. Thank You!!!

  • @b0rn4destroy52
    @b0rn4destroy52 Před 3 lety +1

    cameraman is also learning c++😂 cameraman is legend

  • @hardikgupta7924
    @hardikgupta7924 Před 3 lety +1

    Can you pls arrange this playlist in sequence so that it would be efficiently accessible .

    • @gauravraj4507
      @gauravraj4507 Před 3 lety

      bhai order me pta chla?

    • @rohitverma-xz2uy
      @rohitverma-xz2uy Před 3 lety

      @@gauravraj4507 bhai oder pta chla bhai

    • @gauravraj4507
      @gauravraj4507 Před 3 lety

      @@rohitverma-xz2uy nhi bhai, ab khi or se pdhna pd rha hai😔.. Agr inke order me hoti to best site thi ye c++ k lie

  • @sarthakkhurana4158
    @sarthakkhurana4158 Před 5 lety +6

    why he doesn't write "using namespace std" in his programs?

  • @surbhirajput1443
    @surbhirajput1443 Před 2 lety

    Where the previous session of static memory allocation its nt in the playlist

  • @sudipsen3677
    @sudipsen3677 Před 3 lety

    Nice explanation ❤️🙂

  • @soniyajain6732
    @soniyajain6732 Před 3 lety

    can I work on any c++ project (my 1st project) after learning from this playlist ??

  • @keshavchopra6588
    @keshavchopra6588 Před 5 lety

    Excellent teaching,😊

  • @shishuranjansinha8015
    @shishuranjansinha8015 Před 6 lety +1

    You r the best

  • @gourishanker7419
    @gourishanker7419 Před 4 lety

    sir we can also declare an array as a[n]...So why we use new. Operator.

  • @shambhavamchoudhary67
    @shambhavamchoudhary67 Před 3 lety +2

    10:19 sir integer requires 4 byte memory

  • @ajazamin9843
    @ajazamin9843 Před 3 lety

    Sir you are not getting the integers entered through keyboard please insert a code to enter array values and scan the entered values

  • @hardik06394
    @hardik06394 Před 2 lety

    Thankyou sir

  • @soubathat712
    @soubathat712 Před 6 lety +1

    Super thalaiva

  • @Ri-hg6hs
    @Ri-hg6hs Před 5 lety

    Mindboggling👌👌👌👌👌

  • @adarshkhare7194
    @adarshkhare7194 Před 4 měsíci +1

    sir, in this video you are doing too much verbal teaching please explain by writing in board....

  • @SafarMansuri-eu4gv
    @SafarMansuri-eu4gv Před 3 lety

    in last program how the compiler know 'n' is array type variable?

  • @shamsillahi1337
    @shamsillahi1337 Před 6 lety

    Sir you are amazing Thanks alooooooooot

  • @elijaheinstein160
    @elijaheinstein160 Před 6 lety +1

    shouldn't that be delete []p ?

  • @mallappamalba9187
    @mallappamalba9187 Před 5 lety

    Nice explanation sir

  • @mehularora3234
    @mehularora3234 Před 4 lety

    there are some minor errors in your program : 1.iostream is independent can be used without .h
    2.conio.h is a turbo specific header file, not specified in c or c++.(Sir you need to update yourself to a better modern compiler).
    3.Not using namespace std;

    • @maheshshirsat9075
      @maheshshirsat9075 Před 4 lety

      he must have been updated himself now.this video was posted in 2017

  • @hardik06394
    @hardik06394 Před 2 lety

    15:16

  • @muhammadumariqbal8172
    @muhammadumariqbal8172 Před 4 lety

    good work sir keep it up

  • @madhav3444
    @madhav3444 Před 4 lety +1

    We could also use this code :
    #include
    using namespace std;
    int main()
    {
    int n;
    cin>>n;
    int arr[n];
    for(int i =0; i>arr[i];
    }
    for(int i =0; i

    • @pranavrai7252
      @pranavrai7252 Před 3 lety +1

      after you are done using your program , the array you created still holds the the memory while in DMC we get our memory back once the purpose of program is completed

  • @dineshkarankot2369
    @dineshkarankot2369 Před 5 lety

    Tq sir ur great

  • @ramanakumar4232
    @ramanakumar4232 Před 3 lety

    In arrays allocation of memory starts from 0 ,do I am right

  • @RajnishKumar-bv2mw
    @RajnishKumar-bv2mw Před 5 lety

    Best programming you tube channel

  • @pratikdixit1313
    @pratikdixit1313 Před 2 lety

    Sir How p[i] can be used for input and output?

  • @sushantkumar8979
    @sushantkumar8979 Před 3 lety

    awsm teacher

  • @Vishnu-ob4fu
    @Vishnu-ob4fu Před 5 lety

    Superb class🙏

  • @felixkimutai8478
    @felixkimutai8478 Před 5 lety

    Great job !

  • @user-ed4zo2ix7o
    @user-ed4zo2ix7o Před 11 měsíci

    can you give the proper sequence of video

  • @makhdooom2715
    @makhdooom2715 Před 4 měsíci

    bro what the use of dma

  • @nehaphuse7758
    @nehaphuse7758 Před 5 lety

    Sir how to create cpp file shortcut on desktop... I couldn't get that... Bcoj while opening my turbo c++ i takes more time... Anybody plz tell me.. how to create shortcut cpp file on desktop. To open direct blank progrm....

  • @RahulGPT-A
    @RahulGPT-A Před rokem

    Cin>>(p+i); not working on VS code

  • @soniamalik4929
    @soniamalik4929 Před 3 lety

    We may also do free(ptr)I guess!

  • @rohiniyadav9703
    @rohiniyadav9703 Před 3 lety +1

    Where is the previous lecture??

  • @vidhyads4539
    @vidhyads4539 Před 5 lety

    good work sir

  • @mridulmacdu
    @mridulmacdu Před 7 lety

    I have a question or confusion in the program. as we know when we declare variable then memory is allocated for that variable ..( int *p; int *q; int *r ;
    then why we say that ,we have to use 'new' keyword to allocate memory for the variable??

    • @softwarefoodiee
      @softwarefoodiee Před 4 lety

      He declared pointers variables not variables.

    • @ajazamin9843
      @ajazamin9843 Před 3 lety

      This is what is called allocating memory dynamically

  • @hareenm5950
    @hareenm5950 Před 4 lety

    sir . one basic doubt , #include here .h is not accepted IDE...as i am fresher i could't find it...please help with that

    • @soniamalik4929
      @soniamalik4929 Před 3 lety

      C++ mein no need to write .h with any header file just write iostream

  • @zara-mx5rx
    @zara-mx5rx Před 6 lety

    Thank you Sir...
    you are the best professor

  • @muradmustakim9539
    @muradmustakim9539 Před 3 lety +1

    Isn't 1 int=4 byte?you are saying that 2 byte!!!!

  • @vishwajeetthoke6028
    @vishwajeetthoke6028 Před 6 lety +1

    sir,it should be cin>>*(p+i);

  • @sohelshaikh2697
    @sohelshaikh2697 Před 4 lety

    #include
    using namespace std;
    int main()
    {
    int n;
    coutn;
    int *p=new int[n];
    for(int i=0;i>p[i];
    }
    cout

  • @daviedevendrachandradat6121

    Can you explain why you put 7, 4, 9 in those blocks at time 22:50

    • @ajazamin9843
      @ajazamin9843 Před 3 lety

      Just for example he did it. But there is a part of code missing which is needed to print enter the three integers and scan them.

  • @anshulgupta8757
    @anshulgupta8757 Před 5 lety

    sir, why do you use getch() function at the end all the time when you don't want to take any input?

    • @srajith4499
      @srajith4499 Před 5 lety

      its used to hold the screen otherwise ur program exits quickly

  • @vijayraghavan7975
    @vijayraghavan7975 Před 5 lety +2

    send me the link for static memory allocation

  • @raeesh2373
    @raeesh2373 Před 4 lety

    Sir first for loop me value store ke liye aap cin me aap (p+i) ka use kiye h but second cin me aap *(p+i) ka use kiye hain aisa kyu
    Plz any one clear my doubts

    • @bestganesh
      @bestganesh Před 4 lety +1

      Should be *(p+i) in both cases

    • @maheshshirsat9075
      @maheshshirsat9075 Před 4 lety

      @@bestganesh no bro it is correct. for storing the value we use(p+i) and for printing we use *(P+i) that is dereferencing.

    • @softwarefoodiee
      @softwarefoodiee Před 4 lety

      @@maheshshirsat9075 are you sure?

  • @PizzaGamingTheReal
    @PizzaGamingTheReal Před 6 lety

    I think there would be delete []p; not deletr p;

  • @amanbhojak3330
    @amanbhojak3330 Před 4 lety

    Sir how to do it using class

  • @ManishRajput_087
    @ManishRajput_087 Před 3 lety +1

    sir please tell me,
    where is 'i' declared in program

  • @hareenm5950
    @hareenm5950 Před 4 lety

    heap explainion please