struct Example{
int number;
string word;
};
struct Node{
Example ex;
Node* next;
};
int main(){
Example someObject;
someObject.number=10;
someObject.word="hello";
Node* head;
head=new Node;
head->ex=someObject;
head->next=nullpointer;
return 0;
}
someObject is a struct variable created in the stack, while head points to an object created in the heap. So, is it correct to say that head->ex=someObject; copies all someObject members into head->ex and now I have a copy (someObject) in the stack and another copy (head->ex) in the heap, so that if I change the values in someObject it will not affect head->ex value?