Pointers/addresses

Posts 16–30 of 47 · Page 2 of 4
Exactly.

.
Quote Originally Posted by VvITylerIvV View Post
Ok, so in this case...


[php]
array [3]
[/php]

points to the address of array [3], doesn't actually hold a value?
It does hold a value, By pointer they all point to the first one, in which is [php]array[0][/php]
Quote Originally Posted by Auxilium View Post


It does hold a value, By pointer they all point to the first one, in which is [php]array[0][/php]
Yes, my bad, there is an initial address, and arrays is just allocated memory space size of integers..

I think I should go to sleep now..
Quote Originally Posted by Void View Post
Yes, my bad, there is an initial address, and arrays is just allocated memory space size of integers..

I think I should go to sleep now..
It's tew thirty am here. this is why i normally wake up at 12 pm
Quote Originally Posted by Void View Post
Exactly.

.
Quote Originally Posted by Auxilium View Post


It does hold a value, By pointer they all point to the first one, in which is [php]array[0][/php]


wait? what?

Does this
[php]

int array[3];
array[2] = 2222;

[/php

give array[2] the value of 2222, or does it give the address pointed by array[2] the value of 2222...
Quote Originally Posted by VvITylerIvV View Post
wait? what?

Does this
[php]

int array[3];
array[2] = 2222;

[/php

give array[2] the value of 2222, or does it give the address pointed by array[2] the value of 2222...
No.
1. You declared it wrong. Heres how you declare it
[php]int array[3] {number, 2222, number};[/php]
and it gives [php]array[1] [/php] value of 2222

C++ counts from 0.
So if you declare
[php]int array[4][/php]
the members are
[php]array[0]
array[1]
array[2]
array[3][/php]
Quote Originally Posted by Auxilium View Post

No.
1. You declared it wrong. Heres how you declare it
[php]int array[3] {number, 2222, number};[/php]
and it gives [php]array[1] [/php] value of 2222

C++ counts from 0.
So if you declare
[php]int array[4][/php]
the members are
[php]array[0]
array[1]
array[2]
array[3][/php]
No, I believe

[php]
int array [3]
array[2] = 2222
[/php]
would give
array[0] - null
array[1] - null
array[2] - 2222

And I know it counts from 0, why do you think I used [2] not [3]?
Quote Originally Posted by VvITylerIvV View Post
No, I believe

[php]
int array [3]
array[2] = 2222
[/php]
would give
array[0] - null
array[1] - null
array[2] - 2222
Trust me. You dont declare it like that. Youd get compile errors.
i got to the page.
What would be the good of assigning them seperatly? The Null ones are gonna be 0 anyways
It's not about whether or not I assign them... I was wonderng whether or not

array[2] = 2222

would give array[2] the value of 2222, or give the address pointed by array[2] the value of 2222 (which is itself, so it's a stupid question but I still need to know.)
Quote Originally Posted by VvITylerIvV View Post
It's not about whether or not I assign them... I was wonderng whether or not

array[2] = 2222

would give array[2] the value of 2222, or give the address pointed by array[2] the value of 2222 (which is itself, so it's a stupid question but I still need to know.)
just test it
Quote Originally Posted by VvITylerIvV View Post
It's not about whether or not I assign them... I was wonderng whether or not

array[2] = 2222

would give array[2] the value of 2222, or give the address pointed by array[2] the value of 2222 (which is itself, so it's a stupid question but I still need to know.)
Remember it'd give it to Array[1].
Get into the habit it starts from 0. even though you declare [php]int array[3][/php]
it really only goes from [php]array[0] to array[2][/php]
if you dont do this, youll get ugly runtime errors
Posts 16–30 of 47 · Page 2 of 4

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us