Address of the root node

in this code i didn’t understand how the root has still the address when we pop out the address:
like if we 1 2 3 -1 -1 -1 -1
root- >1

then we take a f as pointer for the root reference and pop out that root and assign the f->left and f->right node address . and when we are point out the both nodes
so how the root is able to have still the address. and node are building

root is pointer of type node* we assing the root with an address (root = new node(data); )
now we push this address to queue and process and that we also remove it from queue
but why you think that root should change ??
it is a different variable

suppose a =10
now you push a to queue and then pop
will the value of a will change???

i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved
if you have more doubts regarding this feel free to ask

@asaurabh_26 nope a still have the value but i m thinking like that root = some_address of now and we create other varible means copy of root okay we are making changing to this copy right…
is should not effect the root but root is effecting and building a whole tree based on their copy…

Or it should be like that we changing the stuff at the address of root that’s why it is building the tree???

see we are not changing a varable’s value
but we are changing addresses
so changes will effect the root also

please do dry run for one sample input
it will be more clear

@asaurabh_26 got it brot i actually changing are made on address naaa…

yhea
you got it :+1:

i am glad to help you and
don’t forgot to mark doubt as resolved

@asaurabh_26 ok bhai