Home > Back-end >  Pointer variable indirect reference array element
Pointer variable indirect reference array element

Time:10-18

For (p=a; P What is the meaning of this? P not said address? The for loop explanation/* */pointer variable pointing to an array element, what mean?

CodePudding user response:

Add and subtract said its pointer pointing in the direction of before and after the address of the mobile

10 elements of the array a of address is sequential, as a result, a + 10 is a after the last element of an address (a + 9 is the address of the last element), p shall not exceed the scope of the

P points to an array, the elements of a * p is pointed out by the location of the element's value

CodePudding user response:

P is a pointer, and a is the address of the first array, address + - equivalent to after moving forward, here is to array traversal

CodePudding user response:

Pointer value is the address, so the pointer + 1 + 1 is address, according to the results of this address of a pointer type to determine, if it is a char *, a byte address result becomes greater, if is int * increases 4 bytes, and so on

CodePudding user response:

reference qybao reply: 3/f
pointer value is the address, so the pointer + 1 + 1 is address, according to the results of this address of a pointer type to determine, if it is a char *, a byte address result becomes greater, if is int * increases 4 bytes, etc.

Oh oh, learned, thank you

CodePudding user response:

1/f, reference and 蘤 old crepe response:
add and subtract said its pointer pointing in the direction of before and after the address of the mobile

10 elements of the array a of address is sequential, as a result, a + 10 is a after the last element of an address (a + 9 is the address of the last element), p shall not exceed the scope of the

P points to an array, the elements of a * p is pointed out by the value of the position of element

Know, thank you

CodePudding user response:

refer to the second floor roylam12345 response:
p is a pointer, which is the address of the first array, a + - equivalent to address after moving forward, here is equal to the array traversal

Got it, thank you!
  • Related