1, 使ç¨å符æ°ç»,å¦:
char StringArray[] = "I am a boy";
2, 使ç¨å符æé
char *pString;
å¯ä»¥ç´æ¥å¶åä¸ä¸ªå符串
pString = "I am a boy";
ä¹å¯ä»¥ç³è¯·èªå·±ç空é´,ç¶åæå符串éè¿strcpyå½æ°æ·è´è¿æ¥,å¦:
pString = (char *)malloc( (strlen("I am a boy") + 1) * sizeof(char) );
strcpy(pString, "I am a boy");
æ¯è¾çè¯å¦2楼æ说,使ç¨strcmpå½æ°.
温馨提示:答案为网友推荐,仅供参考