GDC Class Notes

Class Notes of Graduate Diploma in Computing in Unitec

A Short Note About Data Structure ISCG6425

Some Data type

  • int 2^16 -30k - 30k, 2bytes
  • long int 2^32 4bytes
  • unsigned int 0!60k

Pointer

  • & the memrary address
    • get the value

      int *p // just read 2 bytes from the address (p point to), because of type int
      p = & count, the var count’s address

c pointer and array

1
2
3
4
5
6
7
8
9
10
11
12
void main(void) { 

int a[100], *p, sum=0;

// a for loop to assin the value in an array
// array a is like a pointer

for(p=a; p<&a[100]; ++p){
sum+=*p;
}

}
  • p=a // p get address of a[0]

  • p < &a[100] // p less than the 100 th element in a, the array which does not exsit

  • ++p, address +=2, because *p is a int