开发者

passing argument 1 of strlen from incompatible pointer type

开发者 https://www.devze.com 2023-01-13 05:08 出处:网络
I am taking values from array and saving it in linked list as follows: NSString *formataddr=[RestaurantList obj开发者_运维百科ectAtIndex:0];

I am taking values from array and saving it in linked list as follows:

NSString *formataddr=[RestaurantList obj开发者_运维百科ectAtIndex:0];
node1->formattedAddress = (char*)malloc(strlen(formataddr)*sizeof(char)+1);

where formattedaddress is char array. But I'm getting error

passing argument 1 of strlen from incompatible pointer type

Can anyone help me solve this? Thanks!


You can't use strlen() with NSString *, you have to use [formataddr length].


Try

[formataddr length]

instead of strlen(formataddr)

NSString isn't supported by strlen().

0

精彩评论

暂无评论...
验证码 换一张
取 消