Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shallow copy and deep copy in C

Tags:

I tried googling this but only objected oriented languages pop up as results.

From my understanding a shallow copy is copying certain members of a struct.

so lets say a struct is

typedef struct node
{
    char **ok;
    int hi;
    int yep;
    struct node *next;
}node_t

copying the char** would be a shallow copy

but copying the whole linked list would be a deep copy?

Do I have the right idea or am I way off? Thanks.