C++ Programming: Passing Arrays to Functions

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ก.พ. 2025
  • Code can be found at pastebin.com/CW...
    Concepts:
    Syntax for passing arrays to functions.
    Why is the whole array not passed to a function? save processor cycles and memory (we often don't need a copy anyway)
    What is passed? - the first element of the array.

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

  • @CharlieEarthRoast
    @CharlieEarthRoast 6 ปีที่แล้ว +6

    Omg. You’re a life saver. I’ve learned more from these videos than I have from my professor in the last three weeks when it comes to arrays. I had “ah ha” moments like things were starting to click. Thanks!!

  • @iain-duncan
    @iain-duncan 5 ปีที่แล้ว +1

    I spent something like an hour and a half reading about how to do this, and got nowhere. Took me 6 minutes of watching your video to immediately understand. Thank you so much!

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

    Respect after 8 years

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

    Thank you for your help, much respect for you. (after 8 years :) )

  • @wssz112
    @wssz112 10 ปีที่แล้ว +11

    omg!!! read the book for half hour. cant understand at all
    watch ur video for 3 minutes totally got it!!!!

  • @ElectroHouseR
    @ElectroHouseR 12 ปีที่แล้ว +6

    Thank You!!! Helped a lot! :D
    This 10 minute video helped me more than my stupid 3 hour college class -__-

  • @gabriellelopez-herrera820
    @gabriellelopez-herrera820 5 ปีที่แล้ว

    You are really good explaining how to write c++. Thank you.

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

    4:59 Just what I needed, thank you!

  • @CaptainGibbons
    @CaptainGibbons 12 ปีที่แล้ว

    I'm going to make an A on my program assignment because of these videos. Thank you very much!

  • @ramumagar6981
    @ramumagar6981 12 ปีที่แล้ว

    u are the man, a real man, man man, a 4 apple, b 4 ball, g 4 ganja(n silence) which is mairijuina
    in nepal( g 4 grate=u r that)

  • @RollinShultz
    @RollinShultz 10 ปีที่แล้ว

    When you pass an array, aren't you passing the array name address, not the address of index 0? I believe that is how we are able to set up things such as beginning and ending links. How would we be able to do bounds checking if we didn't actually start before index 0?

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

    Thanks alot buddy 👍

  • @mohdadyg
    @mohdadyg 12 ปีที่แล้ว

    Amazing explanation with example. Thanks a lot.

  • @lamarts1000
    @lamarts1000 10 ปีที่แล้ว

    Great job! Thanks for doing this video

  • @programmingelectronics
    @programmingelectronics 9 ปีที่แล้ว

    Great video - thanks!

  • @jinhe4438
    @jinhe4438 7 ปีที่แล้ว

    why do i need to specify the address of the first element in an array instead of using the array name when calling the function?

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

    Could someone explain to me what he means by passing first element of the array as a reference. If I have an array - myArray[3] = {5, 3, 2}, the function will only grab first element, so value 5. If that's the case for efficiency sake as copying the whole array is costly, how does the function know to print all the other values in the array?

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

    thanks very much my friend

  • @Nahom-kn6ph
    @Nahom-kn6ph ปีที่แล้ว

    What if I don't know the size instead the user enters it?

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

    Thank you very much sir.

  • @teenagemania
    @teenagemania 9 ปีที่แล้ว

    How to return an array values back to the main function.

  • @graceghambi5360
    @graceghambi5360 7 ปีที่แล้ว

    omg gatt exams in 3days time i dont know what amaa write on it.any tips? array pointers.etc anything

  • @rayinoz
    @rayinoz 5 ปีที่แล้ว

    thanks for this useful video,

  • @ReelLearning
    @ReelLearning  12 ปีที่แล้ว +2

    Thanks!

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

    What if your array is a 3x3?

  • @deepakrajak4621
    @deepakrajak4621 5 ปีที่แล้ว

    What about 2D array plzz help and ans

  • @foreveralone4813
    @foreveralone4813 8 ปีที่แล้ว

    what does return -1 means?

    • @32kweezy
      @32kweezy 8 ปีที่แล้ว

      +Forever Alone It terminates the build.

  • @areesharkon
    @areesharkon 8 ปีที่แล้ว

    thanks for u information about Array

  • @swamishekhar8045
    @swamishekhar8045 9 ปีที่แล้ว

    Sir please upload videos regarding this character fuction defining using c++ ..plzzzzzzzzzzzzzzzzzzzzz

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

    I was lost from beginning to end lol not your fault though. Programming just isn't meant to make ACTUAL sense anyway.

  • @juggernaut2726
    @juggernaut2726 5 ปีที่แล้ว

    so.. the use of the size in the video is to make the program know that the size of the arrray is 5??
    im confused.. isnt the size are made to make the array bigger or what

  • @crimerate8719
    @crimerate8719 8 ปีที่แล้ว +5

    Bill Gates is that you ?

  • @memoonabatool7904
    @memoonabatool7904 7 ปีที่แล้ว

    Thanks Good job ..

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

    Very sueful

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

    thank you

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

    so 'double rainfall[5];' and 'array rainfall;' are two completely different things both called arrays. Programmers are less logical than politicians

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

      They are not entirely different things. The data in std::array is still stored exactly like in c-style array, but std::array won't forget its size no matter what you do to it. std::array is also always stored into stack, just like c-style array is.
      In std::array you can access the raw array like this:
      std::array arr;
      array.data()[5];
      for example, if you copy the data from array.data() to c-style array there's 100% compability.
      the .data() function is for combability with api that doesn't support std::array.
      Just one thing to add. There's almost zero overhead with std::array compared to c-style array in terms of performance. Only "NEGATIVE" thing about std::array is that you can't dynamically allocate it. std::vector is there for dynamic allocation and it shouldn't be used for anything else.

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

    This guy has limited knowledge about C++ programming he processing Array a special class is created C++ runtime library known as Vector which handles passing array to function.