C Data Types

Table A.1 shows the fundamental C language data types. You can use them in Objective-C code, but you must convert them into objects if you want to use them inside Objective-C data collections.

Note that the double type is much slower for floating-point calculations, but far more accurate than the float type.

caution_exclamation_2c.eps

The names of C data types are standardized, but the sizes are implementation dependent. The sizes in the table are correct for iOS. Other computer systems use different sizes. This doesn’t matter if your code runs only on iOS devices. It can matter if you use code written for other computers, or share your code with developers who work on other computers. Note also you may come across further types such as short, long double, long long, and so on. The table includes the types you’re most likely to use in your code. The other types are much less common, and only used for specialized tasks.

9781118462133-tbbapp01

Get iOS App Development Portable Genius now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.