Buckys C++ Programming Tutorials - 35 - Passing Arrays to Functions

Sdílet
Vložit
  • čas přidán 9. 04. 2011
  • Source Code: github.com/thenewboston-devel...
    Core Deployment Guide (AWS): docs.google.com/document/d/16...

Komentáře • 353

  • @shalinisahnimankatalia5305
    @shalinisahnimankatalia5305 Před 5 lety +216

    He says loads of times that "How am i going to explain this " and ends up explaining it the best in the world.

    • @entertainingshorts24
      @entertainingshorts24 Před 3 lety

      'Best in the world'...really??
      I think u haven't checked other programmers cum teachers on CZcams.
      He is good, but 'best' signifies Hyperbole ( Atishyokti alankar).

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

      @@entertainingshorts24 But he is literally one of the best if you want the explanation to be short, sweet and entertaining as well. I literally watched 30+ videos of his in a single day and still not bored while if I try to watch some other youtuber explaining it I would probably sleep through 1st tutorial itself.

    • @entertainingshorts24
      @entertainingshorts24 Před 2 lety

      @@omkarjsuvarna may be...but if u are a hindi speaker then u can also follow Codewithharry.

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

      @@entertainingshorts24 Again as I said I want short and sweet explanation to grasp the topic really quickly and once I understood it then I can dive deep to complex programs. For learning basics fast this channel is like a diamond. I've watched tutorials of Codewithharry, but I always stop watching the video after 1 or 2 tutorials. But in this channel, I've never stopped watching it continuously.

    • @svenspajgl9118
      @svenspajgl9118 Před 2 lety

      @@entertainingshorts24 shush kid

  • @aditijoshi4240
    @aditijoshi4240 Před 6 lety +191

    Prof: gimme some name for the array
    Me: bucky

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

      prof: gimme some name of the array you boy
      me: Aditi joshi
      class: hahahahahhhaa
      prof: get the fuck outta here

    • @sameeralam8829
      @sameeralam8829 Před 4 lety +5

      @Shallex little virgin let him laugh

    • @cabreram.4734
      @cabreram.4734 Před 4 lety +2

      Sheez 🤦🏻‍♂️ these virgins are so cringy

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

      For real for real

  • @TrxggerTBeats
    @TrxggerTBeats Před měsícem +1

    Crazy how this tutorial is still as informative 13 years later. Preciate the good work 👏

  • @martyyoung
    @martyyoung Před 10 lety +13

    I have watched 20 or so and some a couple of times just to get it through my head. Great stuff!!!!!

  • @ADwaMoviesandMusicsproduction

    Thank you a million times, I watched like 100 videos for this. I even watched your videos like 10 times but didn't understand because I already belived that it's so hard. And now understand everything from 6:30 to 7:30? Thanks a lot, my home work and project was due to 3 days later. didn't know it's easy.

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

    Bucky, one of the best teacher for programming !

  • @ucheezih1416
    @ucheezih1416 Před 11 lety

    This guy really knows what he's teaching...Two topics in C++ that I found difficult to understand(Multidimensional array and this right here- passing arrays into Functions), he really demystified it all...Even in an easy to understand manner...10x bro...

  • @mituldesai9807
    @mituldesai9807 Před 8 lety

    Excellent class..had no problems understanding whatsoever..u r a lifesaver!!

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

    8 mins of Bucky's tutorials VS 2 whole lectures

  • @Faith-sf2fi
    @Faith-sf2fi Před 4 lety

    These quick videos teach me so much better & faster than my professor and the “teaching” program he makes me buy which mind you is expensive !

  • @jpsplat
    @jpsplat Před 6 lety +2

    This video helped me a bunch on my homework. Thank you!

  • @fatima-oy7gk
    @fatima-oy7gk Před 3 lety

    Wow. I was super stressed. I couldn't understand no matter how many tutorials I watched. Now I do Alhamdolilah. Thank you so much.

  • @AhmadHabibx
    @AhmadHabibx Před 7 lety +11

    He explains everything so much that during 5: 03 he was out of explanations .. Legend

  • @ivanbeltran-salazar117
    @ivanbeltran-salazar117 Před 7 lety +2

    Great tutorial cleared up the basics

  • @rubbeldiekatz85
    @rubbeldiekatz85 Před 12 lety

    thanks man. I wracked my brain about how to put an array into a function. Now my programm is running. I appreciate your help.

  • @killaburribo
    @killaburribo Před 3 lety +5

    literally saving my semester 😭👌🏼

    • @dark-1919
      @dark-1919 Před 2 lety

      which semester brother i mean in which semester it was asked

  • @river6634
    @river6634 Před 8 lety +254

    It annoys me that he keeps asking "What is going on guys?" but doesn't give us time to answer.

    • @QrUpload
      @QrUpload Před 7 lety

      hahhaa nice one bro !

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

      hhhhhhhhhhhhhhhhhhhhh same thing XD

    • @nickbossbg5636
      @nickbossbg5636 Před 7 lety

      xDDDDDDDDDDDDD

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

      when you realize you have no social life

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

      u can just pause and answer it to urself

  • @lmao3295
    @lmao3295 Před 8 lety

    this really confused me for a bit but thanks to you i get it now c:

  • @nukacoaal
    @nukacoaal Před 8 lety +2

    as an options, you can use a vector for this sort of thing, so you won't need to use second variable "sizeofarray".
    but probably it is more advanced lvl.

  • @azstudioproductions
    @azstudioproductions Před 12 lety

    You have been helping me so much ! Thank you so much !

  • @otherworldsAI
    @otherworldsAI Před 8 lety +1

    I love how you teach.

  • @hashcodez757
    @hashcodez757 Před rokem

    great work sir !!
    hats off to you

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

    You know, I've been messing around with arrays and I discovered that you can create an even cooler RNG program using arrays.
    All you have to do is create a for loop where the value of each element in the array is assigned to a seeded random number.
    Here's an example:
    #include
    #include
    #include using namespace std;void romba(int Input[], int Size);int main()
    {
    cout > y; int fofo[y];
    srand(time(0)); for(int x = 0; x < y; x++){ fofo[x]= rand()%y;
    } romba(fofo, y); return 0;
    }void romba(int Array[], int Size){for(int x = 0; x < Size; x++){ cout

  • @arbazkhalid8249
    @arbazkhalid8249 Před 5 lety

    great : i a'm confused how to use array but now i'm happay after your tutorial.

  • @Daniel7681
    @Daniel7681 Před 10 lety +1

    Thanks for making these. :)

  • @gijimbo1337
    @gijimbo1337 Před 9 lety

    FYI (not sure if anyone else has mentioned this yet) if you don't want to worry about the array sizes or don't know the array sizes, look into using vectors.

  • @puvistyne28
    @puvistyne28 Před 7 lety

    Thank you very much...exactly what i expected

  • @alexandersamudra6822
    @alexandersamudra6822 Před 2 lety

    one of the best explain 👍

  • @karthikeyanb6016
    @karthikeyanb6016 Před 6 lety

    amazing bro....... thank u soo much.... u have made this very easy to understand...... ty bro

  • @odorlessflavorless
    @odorlessflavorless Před 5 lety +3

    We went from 360p to 4K in 7 years! Amazing!

  • @user-gt9mw3ou9e
    @user-gt9mw3ou9e Před 7 měsíci

    woww thanks you really helped me a lot, l got a final tomorrow 🔥🔥🔥🔥

  • @KydroxHD
    @KydroxHD Před 7 lety +7

    i listen to this in 1.5 speed, its actually pretty efficient

  • @tokhirbekorifjonov2200

    very good and clear explanation thank you very much

  • @odo432
    @odo432 Před 10 lety

    For someone who's never said WOW in their life you certainly said it a lot in your post.

  • @td4269
    @td4269 Před 8 lety

    This is so useful. Thank you

  • @winnermsigwa4922
    @winnermsigwa4922 Před 2 lety

    Thanks ..and be blessed🙏

  • @omarimtiaz8211
    @omarimtiaz8211 Před 8 lety

    thanks bukky ur tutorials are helpful

  • @Boomerlance
    @Boomerlance Před 12 lety

    Got it!
    thanks again,dude :)

  • @iXenoCider
    @iXenoCider Před 12 lety

    Yes lol, I know, I gave you the link to this video! :D, glad it helped! Goodluck on your coding!

  • @jakubircow6875
    @jakubircow6875 Před 9 lety

    when calling the function, do you put the position of a value in the array in the square brackets when you want to pass the position instead of the whole array ?.

  • @ceciliaamoako9694
    @ceciliaamoako9694 Před 5 lety

    You are a lifesaver

  • @YounesKeraressi
    @YounesKeraressi Před 13 lety

    bucky,you still the best

  • @Michy20
    @Michy20 Před 5 lety

    OMG you saved me! very useful!

  • @syedsamiullah6573
    @syedsamiullah6573 Před 3 lety

    Video almost a decade ago helped me today..😘😘

  • @creativeknowledgemike2337

    in the loop where it says thearray[x] [x] signifies the int right? since it is a int variable?

  • @onurkirec5784
    @onurkirec5784 Před 11 lety

    I wish there were some manner tutorials for guys like you.

  • @Shawn_White
    @Shawn_White Před 6 lety

    I'm using G++ as a compiler and it works even without the prototype.

  • @thehacker8454
    @thehacker8454 Před 6 lety

    Do you have to put the number of elements in the square brackets or can you just leave them empty?

  • @faiqariaz180
    @faiqariaz180 Před 8 lety

    how do we add two different arrays of same length and store the result in any other array

  • @benjaminhao7965
    @benjaminhao7965 Před 5 lety +1

    I have one question. When I define the function printArray before main function, I don't really need to prototype printArray (i.e. Declaration). The program run fine and I got no error or warning messages. How does that even work? Thx!

    • @tanyichun2535
      @tanyichun2535 Před 4 lety

      computer programs read the code from top to bottom, the reason why you need to prototype a function is because the function is defined after the main function, so the computer would have no idea what the function is since it hasn't read the function yet, that's why you need to prototype the function to let it know beforehand that this function will be defined later after the main function. if you define the function before the main function then there's no need to prototype it because the function has already been read before the main function.

  • @giancarloandrebravoabanto7091

    Im looking for a function to take an array redim its size and fill it.
    then print its information from the main

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

    Please help!!
    The autocompletion doesn't work on CodeBlocks for me (knowing that I have everything checked).
    How to overcome that?

    • @blinkerhawk
      @blinkerhawk Před 5 lety

      haha;; I like how you say overcome. You already figured it out I believe

  • @KeepOnCoding
    @KeepOnCoding Před 10 lety +1

    Actually, the reason you don't pass bucky with square brackets is because it is a pointer to the first element of the array.
    You cannot pass the whole block of an array as an argument (mainly because it's very slow to copy the entire array), so you just pass the address of the first element.

  • @Skulltroxx
    @Skulltroxx Před 5 lety

    can we just build the function before the MAIN, so there's no need to add another prototype???

  • @Qazqi
    @Qazqi Před 11 lety

    I'm not quite sure what you're asking, but that statement is fine, provided the variables all have a value.

  • @Genuigr
    @Genuigr Před 12 lety +1

    Little tip for you guys: you can get the length of an array by using this:
    int length = sizeof(array) / sizeof(/*arraytype eg.:*/ integer)

  • @aaron171091
    @aaron171091 Před 9 lety

    hi, i want to implement an application that reads a file, modify its content and write the modification back to the same file? how i can do that? would u please give me some hint?

  • @emrekazoglu4461
    @emrekazoglu4461 Před 4 lety

    what if we had a integer which named as bucky how it is going tounderstand we are talkng about bucky which is array? could you help me

  • @EPKX
    @EPKX Před 11 lety

    yes you have to tell the computer that the elements in the array are integers, it makes sence too since array is nothing but a variable that can have different values at different time depending on the input, we treat x[ ]
    the same way we treat x

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

    Hello Bucky, I hope you still read these comments.Can you do a video on how to use Code::block????? I can't get it to run or compile??thanks.

  • @lobnahamdi4660
    @lobnahamdi4660 Před 7 lety

    thank you !! you are the best :))))

  • @alishbasiddique3729
    @alishbasiddique3729 Před 4 lety

    If there is an other array for input also so what to do

  • @123455866201Aaron
    @123455866201Aaron Před 5 lety

    CZcamsr guides > Your uni lecturer

  • @dickdastardly4835
    @dickdastardly4835 Před 5 lety

    When I run jessica with a size greater than the functions size, it starts showing bucky's integers, but the reverse does not happen. What causes this?

  • @Kalydosos
    @Kalydosos Před 12 lety

    Got the code to compile OK however, my version of the program won't work without the system("pause"); and return 0; within main(). The program flicks the results on screen so quickly you can't see the results without the two functions above does anyone have any answers?

  • @taramughal348
    @taramughal348 Před 3 měsíci

    good. One should also pass the size of array as argument in 1D array. How the function will know the size of the 2D array?

  • @mohdad-fadhilmusa8394
    @mohdad-fadhilmusa8394 Před 3 lety

    I don't understand, the variable x is not declared in the program but there is no error?????

  • @niranjanpradhan3364
    @niranjanpradhan3364 Před 9 lety

    Hello Sir, Array can be overloaded or not,that means if we take two array with same name but different number of parameter,and we pass it through function call then it was not working.

  • @nnja7096
    @nnja7096 Před 6 lety

    @thenewboston can u make a video on how to use array for sentinel loop? i really hope u can help me

  • @adam3416
    @adam3416 Před 6 lety

    I know this is an old video but how would I create a function that takes a single-dimensional array, modifies it (for example, adds 1 to each element), and returns the modified array? It doesn't seem to be as easy as i would have thought.

    • @affiqmohammed981
      @affiqmohammed981 Před rokem

      i'm pretty sure you would just add 1 to each element by going through it in the for loop, like myArray[n] = myArray[n] + 1, then print that element using myArray[n] or something

  • @Globox822
    @Globox822 Před 10 lety +1

    bad ass bucky, thx

  • @jyotiprakashnath1118
    @jyotiprakashnath1118 Před 2 lety

    Really helpful

  • @KemetSon
    @KemetSon Před 7 lety

    why i can't use printarray(bucky[3], 3)
    or printarray(bucky[],3)

  • @MherBedrossian
    @MherBedrossian Před 11 lety

    what kind of a program he's using? doesn't look like visual studio to me, can anyone tell me please ?

  • @linusackermann896
    @linusackermann896 Před 10 lety

    how do i get the length of an array declared elsewhere?

  • @stephanschultz7560
    @stephanschultz7560 Před 4 lety +18

    if you put the main function under the void function, you won't get an error message and will work just fine.

  • @knuhuf2
    @knuhuf2 Před 8 lety

    use sizeof(nameOfArray) to determine the size of an array. This gives you the size in bytes so just divide it by the size of each element in your array, e.g int, float, long = 4 and double = 8.
    I'll throw in an example:
    int myArraySize = sizeof(myArray)/4;

  • @leeonzo4535
    @leeonzo4535 Před 2 lety

    Ok when I do it they change my array values to extreme values
    I changed the array from double to integer and still with the changing values
    What do you think is up with that

  • @ayushmansaxena1929
    @ayushmansaxena1929 Před 5 měsíci

    how to find length of array when only array is passed into the function ?

  • @Dukekilo
    @Dukekilo Před 8 lety +81

    His folder name is Watermelon........hahahahah

  • @TheWarfare07
    @TheWarfare07 Před 7 lety

    very nice. thanks

  • @jirivesely5697
    @jirivesely5697 Před 3 lety

    Why parameters in the void function are separated by a comma and not by a semicolon? I though parameters are as statements and need to be separated each by a semicolon as in case of a for loop. I Am now confused as when to use comma and when semicolon when separating parameters of different functions!!!

  • @Deeredman4
    @Deeredman4 Před 11 lety

    I'm pretty sure you can include the body of your function with your prototype, anyone know if there is a reason you shouldn't do this?

  • @jessicapeters3533
    @jessicapeters3533 Před 6 lety

    First time I've seen my name as a variable - woo! :)

  • @shubhamsingh7405
    @shubhamsingh7405 Před 7 lety

    in function prototype that u used cant we write void printArray(int[],int); ???

  • @wafflez9888
    @wafflez9888 Před 8 lety

    Thanks Bro T T You even care about us more than our teachers do!! (Watch out,Don't forget. You're pro with this) Like seriously Thanks bro!

  • @oviclandez4534
    @oviclandez4534 Před 9 lety

    what about sir printing the element of the array with numbers greater than 10 and reversing it like for example arr[2]={4321,2423,5356} each element should be reverse sample output: 1234 3242 6535

  • @nutsbutdum
    @nutsbutdum Před 9 lety

    Why do we need the parameter int sizeOfArray in the void function, and is the loop function "really" doing any calculation(i.e. the increment statement x++)? Because when we run the code it just print out the elements of the array as they are.

    • @alexzota7378
      @alexzota7378 Před 9 lety

      I believe you need that so you can check if x is less than sizeofArray

    • @zyn2046
      @zyn2046 Před 9 lety

      No it isnt doing any calculations, all the loop does is print out the contents of that specific element. The reason you need the sizeOfArray parameter is so that your loop can know how many times to run but also to make sure you don't go out of bounds. (which is when you try to loop an index which does not exist. Possible reason for a crash.) Hope i helped, Happy coding :)

  • @quantumhm96
    @quantumhm96 Před 12 lety

    Bucky, How do you make return an array in a fucntion?

  • @shazaibmaqsood2957
    @shazaibmaqsood2957 Před 5 lety

    bucky jani tu love ha

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

    Nice video

  • @mateennaeem2039
    @mateennaeem2039 Před rokem

    which compiler is the best

  • @masbro1901
    @masbro1901 Před 4 lety

    what if any number user input not 3/6 /etc ..

  • @koukirippy
    @koukirippy Před 11 lety

    So, I have typed everything exactly as he has but for whatever reason nothing comes up when I build and run it. It did the same thing for the previous video.

  • @TheaDragonSpirit
    @TheaDragonSpirit Před 12 lety

    Do you still need to add the 'Int' on the real function not the prototype?

  • @herp_derpingson
    @herp_derpingson Před 12 lety +2

    :O
    *Jaw Dropped*

  • @InstAmateur
    @InstAmateur Před 10 lety

    The holy oPryze has learned from Master Bucky!

  • @DansonPiano
    @DansonPiano Před 2 lety

    how does the compiler know "sizeOfArray" is the size of the array tho

  • @WolfySnackrib666
    @WolfySnackrib666 Před 11 lety

    What if you had an int named the same thing as the array, how would it know to pick the array and not the int?

  • @muhammadharoon5836
    @muhammadharoon5836 Před 6 lety

    can we run both the arrays at the same time?