構造体の代入
#include <stdio.h> typedef struct { int hoge; char hogeStr[100]; }sHOGE; int main() { sHOGE hoge; sHOGE hogeCopy; sHOGE *pHoge; sHOGE hogeReal; hoge.hoge = 100; snprintf( hoge.hogeStr, sizeof(hoge.hogeStr), "aiueo" ); // 代入 hogeCopy = hoge; printf( "%d, %s\n", hoge.hoge, hoge.hogeStr ); // 100, aiueo pHoge = &hogeReal; // これはいけるのか? *pHoge = hoge; // いける printf( "%d, %s\n", pHoge->hoge, pHoge->hogeStr ); // 100, aiueo return 0; }