Deepcopy: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|C}}: Remove vanity tags) |
Thundergnat (talk | contribs) m (→Structures with pointers: Remove vanity tags) |
||
Line 184: | Line 184: | ||
Structures with pointers which are usually used to represent data structures such as Linked lists, Stacks, Trees, Graphs etc. have to be copied element by element. A simple assignment as in the above example will not be a copy at all. It will be two pointers pointing towards the same memory location. |
Structures with pointers which are usually used to represent data structures such as Linked lists, Stacks, Trees, Graphs etc. have to be copied element by element. A simple assignment as in the above example will not be a copy at all. It will be two pointers pointing towards the same memory location. |
||
<lang C> |
<lang C> |
||
/*Abhishek Ghosh, 15th November 2017*/ |
|||
#include<stdlib.h> |
#include<stdlib.h> |
||
#include<stdio.h> |
#include<stdio.h> |