User Tools

Site Tools


notes:data

This is an old revision of the document!


Table of Contents

Corning Community College

CSCS2320 Data Structures

Course Wiki Page

Projects

dsi0 ael0

URLs

Notes

char x = 0;

char → 1 byte (8 bits) Default char → signed (2^8 → 256 → -128, +127 [one is used for positive/negative value])

the asterisk (*) indicates a “pointer”

  signed char *y = NULL;
              ^
                              

(void*)0 Void pointers are raw memory

  |0|
  ---
  x
  0xdeadbeef
     |NULL(0)|
     ---------
     y
     0xcoffee
     
 -Make y = deadbeef without using "deadbeef" by using the address (&)
 y = &x
 Now, y's data is the address of x
 x contains the data '0'
  |0|
  ---
  x
  0xdeadbeef  <- address
     |0xdeadbeef|
     ------------
     y
     0xcoffee <- address
     
 x = 7;
 *y = 13;
  Now:
  |13|
  ----
  x
  0xdeadbeef  <- address
     |0xdeadbeef|
     ------------
     y
     0xcoffee <- address

Other

notes/data.1535031717.txt.gz · Last modified: 2018/08/23 09:41 by cmerola2