User Tools

Site Tools


ios-labs-s14:basics-objects

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
ios-labs-s14:basics-objects [2014/02/26 12:59]
mbarboi
ios-labs-s14:basics-objects [2014/02/26 13:05]
mbarboi
Line 57: Line 57:
 Pointers are pretty much what they sound like-- they “point” to a location in memory where the actual data is stored. That location in memory is the true container that holds the data. Pointers are pretty much what they sound like-- they “point” to a location in memory where the actual data is stored. That location in memory is the true container that holds the data.
  
-Pointers are a part of regular C and are used because they are more efficient. When we use pointers in our programs, we only need to store and copy a simple pointer, which is really just an address for a space in memory. It’s a relatively small piece of data. If we instead had to store and copy the data being pointed to, we might very quickly run into problems of not having enough memory. +Pointers are a part of regular C and are used because they are more efficient. When we use pointers in our programs, we only need to store and copy a simple pointer, which is really just an address for a space in memory. It’s a relatively small piece of data compared ​to the object itself.
- +
-For example, it’s much more efficient to simply point to the location for a large video file and use that pointer multiple times in code than to actually have to use all the data of that large video file every time we access it in code. +
- +
-Okay, so back to the asterisk: what does it mean to de-reference a pointer? It simply means that we obtain the value stored in the memory where the pointer is pointing to.+
  
 +Note on asterixes: all objective-c objects must be declared with the asterix as shown. **Primitives** and **structs** are not declared with an asterix.
 +  -Primitivies- simple variables, commonly those that contain numbers. Examples: boolean, integer, double, float.
 +  -Structs- a way of grouping variables together in C. Example: CGRect.
ios-labs-s14/basics-objects.txt · Last modified: 2014/02/26 13:05 by mbarboi