我有两个嵌套结构。
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 来做到这一点?
最佳答案
memcpy(global_info->displ_table, &sptr_vrf->route_table[0], sizeof(struct PAGE));
关于c - 嵌套结构中的 Memcpy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21794789/