【まず1嫁】くだすれPython(超初心者用) その59at TECH
【まず1嫁】くだすれPython(超初心者用) その59 - 暇つぶし2ch719:デフォルトの名無しさん
24/06/22 13:39:16.54 o/eWDsQ7.net
>>688 への回答として >>693 は全く不適切
判っててわざと間違ってるんだろうが全く別物
初心者に嘘を教えるのは良くない
URLリンク(ideone.com)
#include <stdio.h>
#include <stdlib.h>
int x;
struct A {
int a;
int b[];
};
struct B {
int a;
int *b;
};
int main(void) {
printf("%zu\n", sizeof(x));
printf("%zu\n", sizeof(struct A));
printf("%zu\n", sizeof(struct B));
struct B b = {0};
b.b = (int *)malloc(4 * sizeof(int));
free(b.b);
/*
struct A a = {0};
a.b = (int *)malloc(4 * sizeof(int)); // compile error
free(a.b); // don't free (may be cause to runtime error)
*/
return 0;
}


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