Posted by : Rhyf Ahmad Wednesday, May 13, 2015

You have already encountered the Objective-C basic data type int.As you will recall, a variable declared to be of type int can be used to contain integral values only—that is, values that do not contain decimal digits. The Objective-C programming language provides three other basic data types: float, double, and char.A variable declared to be of type float can be used for storing floatingpoint numbers (values containing decimal digits).

The double type is the same as type float, typically with roughly twice the range. Finally, the char data type can be used to store a single character, such as the letter a, the digit character 6, or a semicolon (more on this later). In Objective-C, any literal number, single character, or character string is known as a constant. For example, the number 58 represents a constant integer value.The string @"Programming in Objective-C is fun." is an example of a constant character string object. Expressions consisting entirely of constant values are called constant expressions.
So this expression is a constant expression because each of the terms of the expression is a constant value:

128 + 7 – 17

But if i were declared to be an integer variable, this expression would not represent a constant expression:

128 + 7 – i

Contents:

Data Types and Constants
  1. Type int
  2. Type float
  3. Type char
  4. Qualifiers: long, long long, short, unsigned, and signed
  5. Type id

Arithmetic Expressions
  1. Operator Precedence
  2. Integer Arithmetic and the Unary Minus Operator
  3. The Modulus Operator
  4. Integer and Floating-Point Conversions
  5. The Type Cast Operator

Assignment Operators
A Calculator Class
Exercises 



Ebook Preview
Get the ebook now (222 kB)

If the link above doesn't work, try the link below


Mirror: Get the ebook now (222 kB)

Leave a Reply

You can leave a comment to request any article(s), software(s), ebook(s) or report the dead link.
Then I will reply as soon as I can :)

Subscribe to Posts | Subscribe to Comments

Welcome to My Blog

Recent Post

Recent Posts Widget
Instagram

- Copyright © Madriva -Robotic Notes- Powered by Blogger - Designed by Johanes Djogan -