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上不是壞事。 –