该程序在分配附近崩溃。我怎样才能让它工作?提前致谢。对不起,如果它是重新发布。在任何地方都找不到类似的例子。
#include <stdio.h>
typedef struct _kv
{
char *key;
char *value;
} _kv;
typedef struct _kvs
{
_kv *kv;
int size;
} _kvs;
main()
{
_kvs a;
a.kv[0].key = "This is key One";
a.kv[0].value = "This is value One";
a.size = 1;
printf("%s = %s\n", a.kv[0].key, a.kv[0].value);
}