Re: Increment integer
Re: Increment integer
- Subject: Re: Increment integer
- From: Robert Tillyard <email@hidden>
- Date: Fri, 24 Oct 2003 21:38:10 +0100
Yes I would expect '4' if number in a pointer to something that is four
bytes in size. i.e.
If you did
int *number = 0;
number ++;
printf ("%d\n", number);
You would see four but if number is not a pointer you would see 1.
Hope that helps identify the problem.
Regards, Rob.
On Friday, October 24, 2003, at 08:27 pm, Cameron Hayne wrote:
On 24/10/03 1:53 PM, "Eivind Andersen" <email@hidden> wrote:
Int number = 0;
number ++;
or
number = number + 1;
but the value of the variable increases with 4 (!)
Please show us the exact code you are using to increment the variable
and to
print out its value.
The following code prints 1 as it should.
int number = 0;
number++;
NSLog(@"%d", number);
--
Cameron Hayne (email@hidden)
Hayne of Tintagel
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.