Python is just as good as C++ for real apps
grante at visi.com
Fri Jan 25 22:36:14 EST 2002
In article <d0845u844213smjc0f70l2kl0ceso34c57 at 4ax.com>, Courageous wrote:
>> (*p) + 1 adds one to it.
> No it doesn't! (*p) acquires the integer value of whatever is
> sitting at the address referred to by p and creates a
> temporary; this temporary is an int. You're adding 1 to the
> temporary. You're certainly not adding anything at all to
> either p, or the region in memory region in memory which it
> refers to.
The expression "i + 1" doesn't change the value of i either.
I'll try one more time:
int *p,i; // both i and *p are ints
i = 7; // i has the value 7;
*p = 7; // *p has the value 7;
// *p acts like an "int" variable in those statements, right?
(*p) + 1; // expression with value 8;
i + 1; // expression with value 8;
// You have to add parens, but (*p) seems to act like an int in that
// expression also.
// Neither one changes the value of a region of memory, both
// return one more that the last value saved.
(*p) += 1; // increments an integer value by one
i += 1; // increments an integer value by one
// *p is now equal to 8
// i is now equal to 8
// (*p) and i both seem to behave the same there also.
I still claim that with the declartion:
That both i and (*p) are ints.
Grant Edwards grante Yow! I was born in a
at Hostess Cupcake factory
visi.com before the sexual
More information about the Python-list