1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#include <string.h> #include <stdio.h> struct x{ int i; int j; } A[5]; struct y{ int i; int j; struct y * next; } B[5]; int main() { A[0].i = 5; A[0].j = 7; memcpy(&B[0], &A[0], sizeof A[0]); printf("%d %d\n", B[0].i, B[0].j); return 0; }
1
5 7