COMPTNG 10A Chapter Notes - Chapter 4: Dereference Operator, Stephan Endlicher
Document Summary
Double* ptr = ptr is type double pointer; ptr is a pointer of type double bytes. Addresses written in bytes int and floats = 4 chars and bools = 1 string = 24. * = indirection or dereference operator: access variables of the address pointer is pointing to. Defining a pointer sizeof operator returns the number of bytes to store a variable: sizeof(int) = 4, sizeof(double) = 8 array. White space next to the * in declaration has not affect const double d1 and double const d1 = same thing: double* ptr or double *ptr or double * ptr = same. Do(cid:374)(cid:859)t use a de(cid:272)laratio(cid:374) list for poi(cid:374)ters: double *ptr1, *ptr2; // bad style, double* ptr3; // good, double* ptr4; // good type conversion/casting = changing the type of a variable to another. Double x = 3; // literal 3 from int to double.