C言語なら俺に聞け(入門編)Part 100at TECH
C言語なら俺に聞け(入門編)Part 100 - 暇つぶし2ch556:はちみつ餃子 ◆8X2XSCHEME
12/04/17 20:30:51.83
>>555
一般的な感覚だと
struct hoge* initial_main(void)
{
struct hoge* hog = malloc(sizeof(struct hoge));
hog->A = malloc(sizeof(struct sub)*(2));
hog->B = malloc(sizeof(struct sub)*(4));
hog->C = malloc(sizeof(struct sub)*(8));
hog->C[5].a = 100;
return hog;
}

と定義しといて、
呼出す側は

hog=initial_main();

じゃないかなぁ。


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch