'Best in the world'...really?? I think u haven't checked other programmers cum teachers on UA-cam. He is good, but 'best' signifies Hyperbole ( Atishyokti alankar).
@@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 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.
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.
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...
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
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.
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.
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
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.
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;
the best way to explain why you don't need to label it as an array is because in your prototype you are calling for an array so it will automatically look for an one.
NICE TUTORIALS BUCKY! BUT INSTEAD OF PROTOTYPING FUNCTIONS YOU CAN JUST WRITE THEM BEFORE THE MAIN FUNCTION SO YOU DONT NEED TO COPY THE HEADER,IT WORKS FINE THAT WAY TOO.
Apparently there is no function to return the length of an array in C++. If you want to use the length of an array, you need to use sizeof(*name of your array*) / sizeof(*name of your array*[0]). Sizeof() returns the number of bits a variable has, so if you had an array consisting of integers, and your array had 20 elements, the size of your array would be 80 as the size of an integer is 4.
@Chriscs7 Its better programming practice to write a prototype away from the body of the function, you'll see later on, it makes the code easier to read as well as makes the function more encapsulated which is very important as a programmer.
No, an array has all of the same type of data. Hence, here the datatype is integer. If you wanted to do the alphabet you would probably use char array[] etc, but it can't mix numbers and characters. Hope this helps@Zakareya Alatoli
C++ arrays don't have a Length property (or properties in the C# sense at all). For known sizes, it's best to use std::array, and for dynamic arrays, it's best to use another standard container, std::vector being a good one for general use.
if you change the size of the array in the function to greater than the actual size of the array you get the values of the other arrays, I think it shows you what is in that slot of the ram, a bit like the heartbleed bug
When I make sizeOfArray bigger than it actually is, it steals the value of arrays that were declared before. example: int amazingArray[5] = {16,19,22}; int unrealArray[2] = {69,96,666}; realityBreakingFunction(unrealArray, 7); output: 69 96 666 16 19 22 WHAT"S GOING ON GUYS?
These C++ lessons are awfull and it uses OLD C++. Nobody in the right sense uses regular Arrays. Everybody uses STD::ARRAY It's an containered array. It's safer, got more handy futures build in and just as quick. I defined the size of the array in an oldfasioned way like this: int bucky[3] = { 2,95,304 }; int jessica[6] = { 45,46,78,34,45,2 }; printArray(bucky, sizeof(bucky) / sizeof(bucky[0])); printArray(jessica, sizeof(jessica) / sizeof(jessica[0])); // Number of elements are total size of array divided by the individual sizes of the elements, because different types use different memory sizes.
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?
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 ?.
For anyone thinking where they can use arrays. Here is one example of it: #include using namespace std; int multiman (int sizeit); int main() { int nub; cout
Somehow, I think it's a good practice to make sizeOfArray a const, just to avoid future changes into, that is to avoid getting funny things from compiler if you change by mistake the size of array in your external function. void foo( std::string name[ ], const int n) { ... }
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.
Making prototypes above the main function and then writing a code of that prototype is redundant action. You just can write the function above the function main and it will work perfectly without making a mess in code by typping additional lines.
After 3 months I admit that making prototypes is even better. When you don't make prototypes you have to plan your code so that inner functions have to be above outer ones. By pointing out making prototypes compiler knows about existence inner functions so they don't have to be above the outer ones. Quite helpful, isn't it ?
Not exactly. Commenting can be helpful, but has no effect on compiling. Declaring prototypes of your function tells the compiler that such function exists when is brought out without defining it above. This way compiler knows that there is no reason to panic since it reckons that if declaration was provided, definition will also be provided later.
You aren't wrong when you state that "the reason why an array when called within main isn't using square brackets, is because the name of the array is "Jessica", That was just a little vague,More over it is because the function has taken the parameter of an array first. ex: "void blahblah(int whatever[ ], int sizeofarr)" so when called it will expect the first parameter you type to be the array. If you had passed the size and then the array ex:"(size, arr)"the program most likely not know what you are referring too. Correct me if i am wrong, if this helped Then You're Welcome.
A Canadian is walking down the street with a case of beer under his arm. His friend Doug stops him and asks, "Hey Bob! Whacha get the case of beer for?" "I got it for my wife, eh." answers Bob. "Oh!" exclaims Doug, "Good trade."
He says loads of times that "How am i going to explain this " and ends up explaining it the best in the world.
'Best in the world'...really??
I think u haven't checked other programmers cum teachers on UA-cam.
He is good, but 'best' signifies Hyperbole ( Atishyokti alankar).
@@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.
@@omkarjsuvarna may be...but if u are a hindi speaker then u can also follow Codewithharry.
@@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.
@@entertainingshorts24 shush kid
Crazy how this tutorial is still as informative 13 years later. Preciate the good work 👏
Prof: gimme some name for the array
Me: bucky
prof: gimme some name of the array you boy
me: Aditi joshi
class: hahahahahhhaa
prof: get the fuck outta here
@Shallex little virgin let him laugh
Sheez 🤦🏻♂️ these virgins are so cringy
For real for real
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.
I have watched 20 or so and some a couple of times just to get it through my head. Great stuff!!!!!
8 mins of Bucky's tutorials VS 2 whole lectures
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...
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 !
literally saving my semester 😭👌🏼
which semester brother i mean in which semester it was asked
He explains everything so much that during 5: 03 he was out of explanations .. Legend
Wow. I was super stressed. I couldn't understand no matter how many tutorials I watched. Now I do Alhamdolilah. Thank you so much.
Bucky, one of the best teacher for programming !
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
thanks man. I wracked my brain about how to put an array into a function. Now my programm is running. I appreciate your help.
Excellent class..had no problems understanding whatsoever..u r a lifesaver!!
For someone who's never said WOW in their life you certainly said it a lot in your post.
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.
This video helped me a bunch on my homework. Thank you!
We went from 360p to 4K in 7 years! Amazing!
8K*
i listen to this in 1.5 speed, its actually pretty efficient
damn
Little tip for you guys: you can get the length of an array by using this:
int length = sizeof(array) / sizeof(/*arraytype eg.:*/ integer)
UA-camr guides > Your uni lecturer
Great tutorial cleared up the basics
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.
I'm not quite sure what you're asking, but that statement is fine, provided the variables all have a value.
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
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.
It annoys me that he keeps asking "What is going on guys?" but doesn't give us time to answer.
hahhaa nice one bro !
hhhhhhhhhhhhhhhhhhhhh same thing XD
xDDDDDDDDDDDDD
when you realize you have no social life
u can just pause and answer it to urself
if you put the main function under the void function, you won't get an error message and will work just fine.
this really confused me for a bit but thanks to you i get it now c:
I love how you teach.
great : i a'm confused how to use array but now i'm happay after your tutorial.
Thanks for making these. :)
You have been helping me so much ! Thank you so much !
Thank you very much...exactly what i expected
Its the name of a book, "C++ for Dummies", they have a TON of books like "C# for dummies", "Karate for Dummies", FILLINWORDHERE "For Dummies".
I wish there were some manner tutorials for guys like you.
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;
woww thanks you really helped me a lot, l got a final tomorrow 🔥🔥🔥🔥
the best way to explain why you don't need to label it as an array is because in your prototype you are calling for an array so it will automatically look for an one.
Video almost a decade ago helped me today..😘😘
great work sir !!
hats off to you
I'm using G++ as a compiler and it works even without the prototype.
Yes lol, I know, I gave you the link to this video! :D, glad it helped! Goodluck on your coding!
amazing bro....... thank u soo much.... u have made this very easy to understand...... ty bro
very good and clear explanation thank you very much
one of the best explain 👍
NICE TUTORIALS BUCKY! BUT INSTEAD OF PROTOTYPING FUNCTIONS YOU CAN JUST WRITE THEM BEFORE THE MAIN FUNCTION SO YOU DONT NEED TO COPY THE HEADER,IT WORKS FINE THAT WAY TOO.
Apparently there is no function to return the length of an array in C++. If you want to use the length of an array, you need to use sizeof(*name of your array*) / sizeof(*name of your array*[0]). Sizeof() returns the number of bits a variable has, so if you had an array consisting of integers, and your array had 20 elements, the size of your array would be 80 as the size of an integer is 4.
Got it!
thanks again,dude :)
Thanks ..and be blessed🙏
Besides LeBron, you are the GOAT.
@Chriscs7 Its better programming practice to write a prototype away from the body of the function, you'll see later on, it makes the code easier to read as well as makes the function more encapsulated which is very important as a programmer.
This is so useful. Thank you
thanks bukky ur tutorials are helpful
No, an array has all of the same type of data. Hence, here the datatype is integer. If you wanted to do the alphabet you would probably use char array[] etc, but it can't mix numbers and characters. Hope this helps@Zakareya Alatoli
The holy oPryze has learned from Master Bucky!
Normally you don't want to copy the entire array, you use a pointer. And the array should be allocated on the heap anyways
bucky,you still the best
C++ arrays don't have a Length property (or properties in the C# sense at all). For known sizes, it's best to use std::array, and for dynamic arrays, it's best to use another standard container, std::vector being a good one for general use.
ahhh Jessica... the one that got away
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?
Do you still need to add the 'Int' on the real function not the prototype?
if you change the size of the array in the function to greater than the actual size of the array you get the values of the other arrays, I think it shows you what is in that slot of the ram, a bit like the heartbleed bug
Oh... Thank you for an information,
First time I've seen my name as a variable - woo! :)
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!
OMG you saved me! very useful!
Try printing an array through the function with more indices than it has. You won't get a compiler error ;)
You are a lifesaver
Can't get the Bucky O Hare song out my head now. Ha.
When I make sizeOfArray bigger than it actually is, it steals the value of arrays that were declared before. example:
int amazingArray[5] = {16,19,22};
int unrealArray[2] = {69,96,666};
realityBreakingFunction(unrealArray, 7);
output:
69
96
666
16
19
22
WHAT"S GOING ON GUYS?
interesting
You're accessing memory after that array. All sorts of shit can happen :)
These C++ lessons are awfull and it uses OLD C++. Nobody in the right sense uses regular Arrays. Everybody uses STD::ARRAY It's an containered array. It's safer, got more handy futures build in and just as quick.
I defined the size of the array in an oldfasioned way like this:
int bucky[3] = { 2,95,304 };
int jessica[6] = { 45,46,78,34,45,2 };
printArray(bucky, sizeof(bucky) / sizeof(bucky[0]));
printArray(jessica, sizeof(jessica) / sizeof(jessica[0]));
// Number of elements are total size of array divided by the individual sizes of the elements, because different types use different memory sizes.
fucking legend. my final now looks possible fucking life saver
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?
I don't understand, the variable x is not declared in the program but there is no error?????
Jessica 6 is the name of the main female character in the Logan's Run movie.
Do you have to put the number of elements in the square brackets or can you just leave them empty?
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 ?.
For anyone thinking where they can use arrays.
Here is one example of it:
#include
using namespace std;
int multiman (int sizeit);
int main()
{
int nub;
cout
***** Okay, thanks.
Fuck this... I'm in civil engineering and we have this... Harder than calculus!
We can write int *theArray instead of int theArray[]. Right?
how to find length of array when only array is passed into the function ?
Somehow, I think it's a good practice to make sizeOfArray a const, just to avoid future changes into, that is to avoid getting funny things from compiler if you change by mistake the size of array in your external function.
void foo( std::string name[ ], const int n) { ... }
JC Stelu nope
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.
Making prototypes above the main function and then writing a code of that prototype is redundant action. You just can write the function above the function main and it will work perfectly without making a mess in code by typping additional lines.
I get it
Thats funny because i was thinking the same thing,
Couldn't he have just put the other function above main and would have been good to go?
After 3 months I admit that making prototypes is even better. When you don't make prototypes you have to plan your code so that inner functions have to be above outer ones. By pointing out making prototypes compiler knows about existence inner functions so they don't have to be above the outer ones. Quite helpful, isn't it ?
yeah so its sorta like a comment in a way? helping you understand your code or remember it correct?
Not exactly. Commenting can be helpful, but has no effect on compiling. Declaring prototypes of your function tells the compiler that such function exists when is brought out without defining it above. This way compiler knows that there is no reason to panic since it reckons that if declaration was provided, definition will also be provided later.
what kind of a program he's using? doesn't look like visual studio to me, can anyone tell me please ?
His folder name is Watermelon........hahahahah
my folder name is tits......hahahaha
FUCK
:O
*Jaw Dropped*
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?
do arrays in c++ have no length method?
You aren't wrong when you state that "the reason why an array when called within main isn't using square brackets, is because the name of the array is "Jessica", That was just a little vague,More over it is because the function has taken the parameter of an array first. ex: "void blahblah(int whatever[ ], int sizeofarr)" so when called it will expect the first parameter you type to be the array. If you had passed the size and then the array ex:"(size, arr)"the program most likely not know what you are referring too.
Correct me if i am wrong, if this helped Then You're Welcome.
bad ass bucky, thx
thank you !! you are the best :))))
Bucky, How do you make return an array in a fucntion?
Why can't you just put the entire function before main? Is that bad practice?
in the loop where it says thearray[x] [x] signifies the int right? since it is a int variable?
A Canadian is walking down the street with a case of beer under his arm.
His friend Doug stops him and asks, "Hey Bob! Whacha get the case of beer
for?"
"I got it for my wife, eh." answers Bob.
"Oh!" exclaims Doug, "Good trade."
how do we add two different arrays of same length and store the result in any other array
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?
how does the compiler know "sizeOfArray" is the size of the array tho
Not codeblocks Its Dev-C++ available on sourceforge he mentioned it in the 1st tutorial