'Best in the world'...really?? I think u haven't checked other programmers cum teachers on TH-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.
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
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.
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;
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.
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.
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.
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
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
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
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.
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.
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 ?.
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) { ... }
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?
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.
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
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!
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.
I'm trying to make a card game and shuffle the cards, then deal them (3 cards will be dealt per play), but I keep getting multiple duplicate values for the shuffled and dealt cards. The values in the array are 0 - 51, each of which represent one of the 52 cards. Here are the two functions. top is the top card in the deck array and numCards keeps track of how many cards have been dealt. void shuffle(int numCards, int deck[ ]) { for (int top = 0; top < 52; top++) { int r = rand() % 52; int temp = deck[top]; deck[top] = deck[r]; deck[r] = temp; cout
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.
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 TH-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
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
Crazy how this tutorial is still as informative 13 years later. Preciate the good work 👏
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
literally saving my semester 😭👌🏼
which semester brother i mean in which semester it was asked
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 !
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...
Wow. I was super stressed. I couldn't understand no matter how many tutorials I watched. Now I do Alhamdolilah. Thank you so much.
He explains everything so much that during 5: 03 he was out of explanations .. Legend
Bucky, one of the best teacher for programming !
Excellent class..had no problems understanding whatsoever..u r a lifesaver!!
This video helped me a bunch on my homework. Thank you!
thanks man. I wracked my brain about how to put an array into a function. Now my programm is running. I appreciate your help.
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
For someone who's never said WOW in their life you certainly said it a lot in your post.
Great tutorial cleared up the basics
We went from 360p to 4K in 7 years! Amazing!
8K*
i listen to this in 1.5 speed, its actually pretty efficient
damn
this really confused me for a bit but thanks to you i get it now c:
woww thanks you really helped me a lot, l got a final tomorrow 🔥🔥🔥🔥
I love how you teach.
I'm not quite sure what you're asking, but that statement is fine, provided the variables all have a value.
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.
Video almost a decade ago helped me today..😘😘
Thank you very much...exactly what i expected
great : i a'm confused how to use array but now i'm happay after your tutorial.
great work sir !!
hats off to you
TH-camr guides > Your uni lecturer
Yes lol, I know, I gave you the link to this video! :D, glad it helped! Goodluck on your coding!
Little tip for you guys: you can get the length of an array by using this:
int length = sizeof(array) / sizeof(/*arraytype eg.:*/ integer)
You have been helping me so much ! Thank you so much !
one of the best explain 👍
Thanks for making these. :)
very good and clear explanation thank you very much
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
amazing bro....... thank u soo much.... u have made this very easy to understand...... ty bro
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
I'm using G++ as a compiler and it works even without the prototype.
Thanks ..and be blessed🙏
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.
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;
I wish there were some manner tutorials for guys like you.
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".
bucky,you still the best
thanks bukky ur tutorials are helpful
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.
This is so useful. Thank you
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!
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.
Besides LeBron, you are the GOAT.
OMG you saved me! very useful!
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.
First time I've seen my name as a variable - woo! :)
You are a lifesaver
if you put the main function under the void function, you won't get an error message and will work just fine.
The holy oPryze has learned from Master Bucky!
Got it!
thanks again,dude :)
His folder name is Watermelon........hahahahah
my folder name is tits......hahahaha
FUCK
thank you !! you are the best :))))
ahhh Jessica... the one that got away
bucky jani tu love ha
fucking legend. my final now looks possible fucking life saver
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.
Can't get the Bucky O Hare song out my head now. Ha.
bad ass bucky, thx
Fuck this... I'm in civil engineering and we have this... Harder than calculus!
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.
Normally you don't want to copy the entire array, you use a pointer. And the array should be allocated on the heap anyways
@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.
:O
*Jaw Dropped*
Try printing an array through the function with more indices than it has. You won't get a compiler error ;)
This guy is good😃😃
what a great video
very nice. thanks
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
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?
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,
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.
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.
Jessica 6 is the name of the main female character in the Logan's Run movie.
Really helpful
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 ?.
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
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?
Nice video
Do you have to put the number of elements in the square brackets or can you just leave them empty?
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.
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
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!
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.
I don't understand, the variable x is not declared in the program but there is no error?????
this video came out when i turned
11. i feel old.
Thank you so so much :DDDDDDDDDD
I'm trying to make a card game and shuffle the cards, then deal them (3 cards will be dealt per play), but I keep getting multiple duplicate values for the shuffled and dealt cards. The values in the array are 0 - 51, each of which represent one of the 52 cards. Here are the two functions. top is the top card in the deck array and numCards keeps track of how many cards have been dealt.
void shuffle(int numCards, int deck[ ]) {
for (int top = 0; top < 52; top++)
{
int r = rand() % 52;
int temp = deck[top];
deck[top] = deck[r];
deck[r] = temp;
cout
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?
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.
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
Do you still need to add the 'Int' on the real function not the prototype?
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."