声æçæ¶åååç»èµå¼ç¥æä¸åï¼å¨Cè¯è¨ä¸æ¯ä¸¤ç§å¤çæ¹æ³ã
å¦æç»æä½
struct test
{
int a;
char c;
int b;
};
å®ä¹çæ¶åï¼å¯ä»¥
struct test var = {1,'c', 2};
è¿æ ·åå§åï¼ç»æ为var.a = 1, var.c = 'c', var.b = 2;
ä½æ¯å¦æåç»èµå¼
var = {1,'c', 2};
å°±ä¼æ¥éãå 为å¨Cè¯è¨ä¸ä¸æ¯æè¿ç§å½¢å¼çæä½ã
ä¸è¿å¯ä»¥å巧转æ¢ä¸ä¸ï¼æ¹æ
var = (struct test){1,'c', 2};
è¿æ ·å°±å¯ä»¥äºã å¨è¿ç§æ
åµä¸ï¼ç³»ç»ä¼ç³è¯·ä¸ä¸ªä¸´æ¶åéï¼å¹¶åå§å为该å¼ï¼å对varè¿è¡èµå¼ãèåç±»åç»æä½ä¹é´èµå¼æä½æ¯Cè¯è¨è§åå
许çã
温馨提示:内容为网友见解,仅供参考