what arithmetic can you do with pointers? addition, subtraction, multiplication?
If you assign a 0 to a pointer would it make the pointer point to nothing?
what arithmetic can you do with pointers? addition, subtraction, multiplication?
If you assign a 0 to a pointer would it make the pointer point to nothing?
>what arithmetic can you do with pointers?
You can add or subtract by an integer, or subtract by a pointer. All of these are only strictly defined for pointers into an array or simulated array.
>If you assign a 0 to a pointer would it make the pointer point to nothing?
Close enough, yes.
My best code is written with the delete key.
can a pointer variable store the address of another variable?
does an array's name store the address of the array's first element?
Is an array's name a pointer, constant, and a variable?
>can a pointer variable store the address of another variable?
Yes:
x now points to the memory address of a.Code:int a; int *x=&a;
>does an array's name store the address of the array's first element?
I always answer this wrong, so I'm not going to embarass myself.
>Is an array's name a pointer, constant, and a variable?
See above.
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
The array's name is a pointer to the first (0th) element. The subscript simply adds that value to the base address (the first element of the array). For some fun, try the following (and you'll see what I mean):
*edit*Code:int array[4] = { 1, 2, 4, 8 }; std::cout << array[3] << std::endl; std::cout << 3[array] << std::endl;
I hope no one saw that.
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.
>can a pointer variable store the address of another variable?
That's really the definition of a pointer, isn't it?
>does an array's name store the address of the array's first element?
No, but in most cases the name of an array is converted to a pointer to the first element.
>Is an array's name a pointer, constant, and a variable?
No, somewhat, and yes. Contradictory, no? Try this on for size.
My best code is written with the delete key.