我基本上想创建一个char[]数组并将char *指针的内容复制到其中。
这是我的代码
NSString * userId = @"1001";
const char * userIDUTF = [userId UTF8String];
char array1[userid.length];
memcpy(array1, userIDUTF, userId.length);
// array1 prints "1" i.e only the first element of userId
我希望将 userId 的全部内容放入array1[]数组中。提前致谢。