I RENAMED some "variables" and "parameter" so that it makes more distinction between MAIN method and GETOTAL method. Make sure you didn't missed every Bro Code's lesson. ~~~ #include double getTotal(double prices[], int size); // (METHOD) MAIN ENTRY-POINT int main() { // MAIN'S VARIABLE (It means that everything inside here is only accesible inside this method) double prices[] = { 49.99, 15.05, 75, 9.99 }; int size = sizeof(prices) / sizeof(prices[0]); double total = getTotal(prices, size); // Calls the getTotal() method returns a value (in this context, it is a double data-typed value) std::cout
Arrays do not know their size, they are just memories full of stuff in it. So when u do array[index], it will try to remember if that index has something in it or not. so it just try to remember it, it does not know the size but the memory made it able to remember the stuff in it. If u want to know the size u need to find it ur own since the arrays are too dumb to count and need some help counting it since they're just memories
@@user-lyf4isnt7daijobu hey tried but it is showing me error "this range-based 'for' statement requires a suitable "begin" function and none was found"
@@yashraj52_ oh yeah tried it myself jus now.. my bad :( we can do this tho.. #include #include double getTotal(const std::vector& prices); int main() { int size; std::cout size; std::vector prices(size); for (int i = 0; i < size; i++) { std::cout
#include
double getTotal(double prices[], int size);
int main()
{
double prices[] = {49.99, 15.05, 75, 9.99};
int size = sizeof(prices)/sizeof(prices[0]);
double total = getTotal(prices, size);
std::cout
bro's so good at teaching and makes it fun, thanks so much!
Bro makes learning fun, yet is so underrated :(
damn, everything was straight forward until this video😅 shit i still dont know how to pass arrays to functions after watching this 5 times
Peace be with you
dude, just make it five times without looking
I RENAMED some "variables" and "parameter" so that it makes more distinction between MAIN method and GETOTAL method.
Make sure you didn't missed every Bro Code's lesson.
~~~
#include
double getTotal(double prices[], int size);
// (METHOD) MAIN ENTRY-POINT
int main()
{
// MAIN'S VARIABLE (It means that everything inside here is only accesible inside this method)
double prices[] = { 49.99, 15.05, 75, 9.99 };
int size = sizeof(prices) / sizeof(prices[0]);
double total = getTotal(prices, size); // Calls the getTotal() method returns a value (in this context, it is a double data-typed value)
std::cout
Do you get it now?
Nice Video keep it up.
Arrays do not know their size, they are just memories full of stuff in it. So when u do array[index], it will try to remember if that index has something in it or not. so it just try to remember it, it does not know the size but the memory made it able to remember the stuff in it. If u want to know the size u need to find it ur own since the arrays are too dumb to count and need some help counting it since they're just memories
Lol thank you for this 😂
I learned java, and java arrays have the size built in, so this C++ array quirk was confusing to me
Why do we have to give an array an initial size If it doesn’t know the size anyways
Couldn't we do this with a for each loop?
can't we use foreach loop for this?
we can :)
@@user-lyf4isnt7daijobu hey tried but it is showing me error "this range-based 'for' statement requires a suitable "begin" function and none was found"
@@yashraj52_ oh yeah tried it myself jus now.. my bad :(
we can do this tho..
#include
#include
double getTotal(const std::vector& prices);
int main()
{
int size;
std::cout size;
std::vector prices(size);
for (int i = 0; i < size; i++)
{
std::cout
@@yashraj52_ bro i think it also decays to pointer