Pointers/addresses
I wouldn't get any errors. I am accessing the last array because it's the array I wanted to access. If I were to access array[3] there would be errors, but because there are three arrays, array[2] is perfectly valid.
How am I supposed to test that, no matter what happens I get the same result. array[2] = 2222; is either assigning 2222 to array[2] or assigning 2222 to the value pointed by array[2] (which is array[2])
Which means that either way, array[2] ends up getting the value 2222. It's a question that is meaningless but I need to know whether or not it is assigned or the value pointed by array[2] is assigned.
How am I supposed to test that, no matter what happens I get the same result. array[2] = 2222; is either assigning 2222 to array[2] or assigning 2222 to the value pointed by array[2] (which is array[2])
Which means that either way, array[2] ends up getting the value 2222. It's a question that is meaningless but I need to know whether or not it is assigned or the value pointed by array[2] is assigned.
It's easier to declare it like
[php]int array[3] {number, number, number};[/php]
if you want them to be null, just declare 0, because null is 0 anywayz
[php]int array[3] {number, number, number};[/php]
if you want them to be null, just declare 0, because null is 0 anywayz
I know that... but I needed to assign just a single array, to ask my question. I understand arrays. I understand how to assign variables to them. I understand everything about them. EXCEPT.
When I use array[2] = 2222;
does it assign 2222 to array[2] or does it assign 2222 to the value pointed by array[2]
PLEASE DO NOT REPLY UNLESS YOU ARE GOING TO ANSWER MY DAMN QUESTION.
When I use array[2] = 2222;
does it assign 2222 to array[2] or does it assign 2222 to the value pointed by array[2]
PLEASE DO NOT REPLY UNLESS YOU ARE GOING TO ANSWER MY DAMN QUESTION.
int array[5] = {16, 15, 14, 13, 12 };
assigns the values to an address
as seen here
1232 ------- 1233 ---------- 1234 --------- 1235 --------- 1236 (addresses)
16 ---------- 15 ------------- 14 ------------ 13 ------------- 12 (values)
array[4] would point to the value of 1236, which is array[4]
I'm done here, because nobody understands my question...
I am going to ask both my questions which I need answered here. do NOT reply unless you are going to answer one, if not both. If you have to say anything else do NOT reply.
1. Does array[4] hold a value, or does it point to an address?
2. Does array[4] = 4444 change the value of the address pointed by array[4](1236) or does it directly change the value of array[4]? (they are pretty much the same thing but I need to know which one it does.)
again.
DO NOT REPLY UNLESS YOU ARE GOING TO ANSWER MY DAMN QUESTION.
assigns the values to an address
as seen here
1232 ------- 1233 ---------- 1234 --------- 1235 --------- 1236 (addresses)
16 ---------- 15 ------------- 14 ------------ 13 ------------- 12 (values)
array[4] would point to the value of 1236, which is array[4]
I'm done here, because nobody understands my question...
I am going to ask both my questions which I need answered here. do NOT reply unless you are going to answer one, if not both. If you have to say anything else do NOT reply.
1. Does array[4] hold a value, or does it point to an address?
2. Does array[4] = 4444 change the value of the address pointed by array[4](1236) or does it directly change the value of array[4]? (they are pretty much the same thing but I need to know which one it does.)
again.
DO NOT REPLY UNLESS YOU ARE GOING TO ANSWER MY DAMN QUESTION.
What do you not understand about array[4] points to array[0]
So, it points, doesnt store a value.
and yes, changing the values of pointers changes the pointed object. Like i said in the other thread. Indirect access.
That SHOULD answer your question
An array is just memory stored away to hold values
So, it points, doesnt store a value.
and yes, changing the values of pointers changes the pointed object. Like i said in the other thread. Indirect access.
That SHOULD answer your question
An array is just memory stored away to hold values
Btw im going to say something about the pointer initialization. Either initialize it with NULL (already said, not sure), or just use malloc to allocate the memory for it.
Btw why are you learning Array now? i remember i learned about arrays before strings and etc... (C)
Btw why are you learning Array now? i remember i learned about arrays before strings and etc... (C)
Similar Threads
C++/C ProgrammingFinding static pointer address? C++SC 0 C++/C Programming[Help]Pointer Address25 6 Combat Arms Hack Coding / Programming / Source CodeThe Enemy Player Pointer Address 39 WarRock - International HacksKurwa Need A Weapon Pointer Work Address! 3 WarRock - International Hacksno fall damage addresse and pointer or value
2




