2014-02-15 163 views
0

我有兩個嵌套結構。嵌套結構中的Memcpy

struct OS_CLASS { 

    PAGE route_table[10]; 

}*sptr_vrf; 

struct PAGE{ 
    int routes; 
} 


struct G-info{ 
    PAGE *displ_table; 
} *global_info 

我需要將sptr_vrf-> route_table [0]複製到global_info-> displ_table。

我該如何使用memcpy來做到這一點?

+0

你想要深度還是淺度複製? –

回答

0

memcpy(global_info->displ_table, &sptr_vrf->route_table[0], sizeof(struct PAGE));