分类: C/C++
2008-04-11 12:37:03
typedef struct { char ip[30]; char usb[30]; }xiaoshou_cmd; |
xiaoshou_cmd *conf,tem; strcpy(tem.ip,"xiaoshou"); printf("ip= %s\n",tem.ip); strcpy(tem.usb,"xiaoshou"); printf("ip= %s\n",tem.usb); |
xiaoshou_cmd *conf,tem; conf=&tem; //结构体指针必须实例化,不然会出现莫名的错误! strcpy(conf->ip,"xiaoshou"); printf("ip= %s\n",conf->ip); strcpy(conf->usb,"xiaoshou"); printf("ip= %s\n",conf->usb); |