← Older edit
Newer edit →
664 bytes added
12:49, 26 May 2010
no edit summary
The real difference is that when you add one to a pointer, it doesn't just add one, it adds 4 bytes (it wants to go to the next integer in memory - or 8 bytes for double, etc). Pointer rithmetic
An array int a will create 10 integers, and then create a pointer to the beginning of that list of integers.
*b = where b is pointing to
&a = the address of a
int* = pointer
a is the same as *a. they are the same.
when you move one integer in the array
a it moves 4 bytes over to the next integer.
Arrays are nothing buy pointers.
After creating an array you can just refer to it as "a" when wanting to get the pointer.
In creating 2D arrays, the pointer for the array is created to be as large as 1 array, so when you say a+1 it skips the entire first array and goes to the next one.
Retrieved from "
SICT AR Meeting Area
get involved with CDOT
as a Student
as an Open Source Community Member
as a Company
Real World Mozilla
Course Project List
Potential Course Projects
About CDOT Wiki