Results 1 to 2 of 2

Thread: using *-symbol

  1. #1


    Member Since
    Oct 04, 2011
    Posts
    6
    using *-symbol
    Tell me please why we place * symbol before boolString and don't do it before areIntsDifferent? Where can I find rules of using * ?

    Code:
    #import <Foundation/Foundation.h>
    
    // returns NO if the two integers have the same
    // value, YES otherwise
    
    BOOL areIntsDifferent (int thing1, int thing2)
    {
        if (thing1 == thing2) {
            return (NO);
        } else {
            return (YES);
        }
    	
    } // areIntsDifferent
    
    
    // given a YES value, return the human-readable
    // string "YES". Otherwise return "NO"
    
    NSString *boolString (BOOL yesNo)
    {
        if (yesNo == NO) {
            return (@"NO");
        } else {
            return (@"YES");
        }
    	
    } // boolString
    
    
    int main (int argc, const char *argv[]) 
    {
        BOOL areTheyDifferent;
    	
        areTheyDifferent = areIntsDifferent (5, 5);
    	
        NSLog (@"are %d and %d different? %@", 
               5, 5, boolString(areTheyDifferent));
    	
        areTheyDifferent = areIntsDifferent (23, 42);
    	
        NSLog (@"are %d and %d different? %@", 
               23, 42, boolString(areTheyDifferent));
    	
        return (0);
    	
    } // main

  2. #2

    xstep's Avatar
    Member Since
    Jun 25, 2005
    Location
    On the road
    Posts
    3,231
    Specs:
    2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
    [QUOTE=sam256;1309963]Tell me please why we place * symbol before boolString and don't do it before areIntsDifferent? Where can I find rules of using * ?

    In the first case you are returning a pointer to a NSString. In the second case you are returning a BOOL value.

    To learn more, get a C or Objective-C programming book to learn about the language. We're not going to teach you it here.
    CameraTime - Time lapse photography for novice and advanced users.

    When asking questions, post the version of your software. You'll receive better answers.

    Please post your results to the thread as it is good feedback.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. What is the symbol for?
    By tenleftfingers in forum OS X - Operating System
    Replies: 14
    Last Post: 10-04-2012, 02:42 AM
  2. What's this symbol I see?
    By MrBruno in forum Switcher Hangout
    Replies: 7
    Last Post: 09-14-2011, 02:29 PM
  3. Has anyone encountered this symbol?
    By caleproductions in forum OS X - Operating System
    Replies: 5
    Last Post: 05-05-2011, 05:10 PM
  4. What does this symbol mean?
    By MelissaR in forum iPhone Hardware and Accessories
    Replies: 4
    Last Post: 03-15-2011, 10:52 PM
  5. What does this symbol mean?
    By shwoot56 in forum iOS and Apps
    Replies: 0
    Last Post: 09-01-2009, 11:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •