Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Numbers and Values in Objective-C and C Programming

on

  • 785 views

 

Statistics

Views

Total Views
785
Views on SlideShare
785
Embed Views
0

Actions

Likes
1
Downloads
3
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Numbers and Values in Objective-C and C Programming Presentation Transcript

  • 1. Paul SoltiPhoneDev.tvNumbersThe data behind our apps
  • 2. Paul SoltiPhoneDev.tvOverview•Integers (27)•printf()•Floating-point numbers (3.14)•Math libraries
  • 3. Paul SoltiPhoneDev.tvIntegers•char: ‘a’,‘b’,‘c’•short: 32,000•int: 2,000,000,000•long: 9,000,000,000,000,000,000•long long: 9,000,000,000,000,000,000
  • 4. Paul SoltiPhoneDev.tvIntegers•char: ‘a’,‘b’,‘c’ (8 bits = 1 byte)•short: 32,000 (16 bits)•int: 2,000,000,000 (32 bits)•long: 9,000,000,000,000,000,000 (32 or 64 bits)•long long: 9,000,000,000,000,000,000 (64 bits)
  • 5. Paul SoltiPhoneDev.tvOverflow99999999991000000010000000
  • 6. Paul SoltiPhoneDev.tvprintf•Formatted text•Tokens•n (i.e. newline or return)%d int%c char%f float/double%s char * (i.e. text)%ld long
  • 7. Paul SoltiPhoneDev.tvMath8 + 4 * 2 = ?(8 + 4) * 2 = ?
  • 8. Paul SoltiPhoneDev.tvInteger Division5 / 2 = ?5 % 2 = ?
  • 9. Paul SoltiPhoneDev.tvInteger Division5 / 2 = 25 % 2 = 1
  • 10. Paul SoltiPhoneDev.tvFloating-point Numbers•float: 3.14•double: 3.141592653
  • 11. Paul SoltiPhoneDev.tvFloating-point Numbers•float: 3.14 (32 bits)•double: 3.141592653 (64 bits)
  • 12. Paul SoltiPhoneDev.tvMath Library#include <stdlib.h>abs(-13); // absolute value#include <math.h>cos(60 * M_PI / 180.0); // radians
  • 13. Paul SoltiPhoneDev.tvReview•Integers•printf()•Floating-point numbers•Math libraries
  • 14. Paul SoltiPhoneDev.tv