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().
精彩评论