typedef struct {
unsigned char a,
unsigned char b,
unsigned char c
}type_a;
typedef struct {
unsigned char e,
unsigned char f[2]
}type_b;
type_a sample;
sample.a = 1;
sample.b = 2;
sample.c = 3;
铸字变量我如何强制转换并分配如新价值:与其他类型定义
sample = (type_b)sample; // syntax error
sample.f[1] = 'a';
没有理由,如果你的问题已经是“我可以做XXX:”不尝试自己。如果你准备好了这个例子,你为什么不运行它?如果你问“我该怎么做”或“是否合法”,情况会有所不同。 –
也许我应该改变我的问题“可以这样做”。我已经知道这是一个语法错误。对不起,煽动你的bejesus – freonix
这确实是一个区别。一般来说,避免是/否问题在forums + co上不是坏事。 –