#include int main() { // pointers = variable that stores a memory address of another variable // sometimes it's easier to work with an address // & address-of operator // * dereference operator std::string name = "Bro"; int age = 21; std::string freePizzas[5] = {"pizza1", "pizza2", "pizza3", "pizza4", "pizza5"}; std::string *pName = &name; int *pAge = &age; std::string *pFreePizzas = freePizzas; std::cout
@tarsow7741
2 ай бұрын
if its not clear to everyone, arrays are just pointers, which point to the first element in the list, for example: arr[i] is the same as *(arr + i), its also one of the reasons you can write i[arr] in C++ and it will give the same output as arr[i], there is also other things that are possible with arrays/pointers: #include int main(int argc, char *argv[]) { int size = 3; int array[size] = {10, 5, 3, 1, -2, -4, -7}; std::cout
@Leon-r7w
2 ай бұрын
Bro has the best videos ngel. W bro❤❤👍
@abdullahsaid-lh1hv
Ай бұрын
bro you are so amazing you solved my biggest problem of pointers love U😘😘😘😘😘😘😘😘
@ZXR4GRZ
7 күн бұрын
Thank you!❤
@MooseShower
Ай бұрын
Thank you! It looks like I just kept forgetting the & which is why my code never worked for my homework
@shreedhoni4522
Жыл бұрын
If I want to locate the pizza3 in the array ,how should I use my pointer?
@game-op8up
Жыл бұрын
Instead of this: std::cout
@dazai826
2 ай бұрын
@@game-op8up yeah, thats why you use int pointers not string pointers. infact myarray[index] is defined in C/C++ to be equivalent to *(myarray + index), thats why while accessing first element by using myarray[0], like in the video, is equivalent to *(myarray + 0) = *(myarray) = *myarray.
why does the output to your freepizzas array and the pointer to said array differs when arrays are already pointers? i tried it myself and for me it outputs the same thing
@wlsedlacek
Жыл бұрын
int pointer = 100; int *pPointer = &pointer
@grimquokka9843
2 ай бұрын
why don't you use namespace std : (
@Pascal-1
Ай бұрын
I'm watching the 6 hours c++ tutorial he made, and there he says that he doesn't like doing that
@Cinarbayramic
Ай бұрын
I think it was considered bad practice cuz other libraries might have functions with the same name
@StampleD2147AI
Ай бұрын
It's because it increases the chance for a namespace collision.
@HiboMoh
14 күн бұрын
He already use :: std if u use (::std) you don’t need using namespace std:
Bro, why don't you show yourself on your video tutorials ? I think it would be more interactive for your pupils or fans to engage learning.
@bigheaddanny3377
10 ай бұрын
because he is evil
@tavares._art
8 ай бұрын
hes dream
@user-xk7de1jw8g
7 ай бұрын
@@bigheaddanny3377 How do you know that? Bro Code dedicates his time to create quality content for his viewers. His video tutorials are great yet he doesn't show up himself. His videos has helped me a lot. I think Bro Code is a good person.
Пікірлер: 33