I wrote a method tha uses myarray, defined in the same class. When I use count it always returns 0.
When I use:
printf("%d", [myarray count]);
compiler says:
Format '%d' expetcs type 'int', but argument 2 has type 'NSUInteger'
why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should use
%luinstead of%d. The compiler checks your format string against the parameters that you are passing toprintf, sees that you are passing an unsigned but print it as a signed integer, and issues a warning. The warning indicates that for numbers greater than or equal to 2^31printfwould output a large negative number, when the data type implies a different semantic, namely, a large positive integer.EDITED in response to comments by Josh Caswell and thepepp