I make a structure just like
struct abc {
//any function or variable
} obje[20];
now I want that the each object of 开发者_JAVA百科abc
store in array. means that arr[0]
contain obj[0]
only; can it is possible. if it is possible then some one help me in this matter.
If you want to copy the objects from the array obje
into the array arr
, you can use memcpy()
from <string.h>
:
#include <string.h>
struct abc arr[20];
memcpy(&arr, &obje, sizeof arr);
/* Now arr[0] has a copy of obje[0], arr[1] has a copy of obje[1], ... */
精彩评论