Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7617027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:02:31+00:00 2026-05-31T03:02:31+00:00

Possible Duplicate: objective c difference between id and void * why most of the

  • 0

Possible Duplicate:
objective c difference between id and void *
why most of the objects we create in iphone are pointers

According to Stanford university course, 2010/2011

Lecture 3

The guy made something strange there (at least for me), which is that

NSString *digit = sender.titlelabel.text;

Why is digit a pointer?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T03:02:33+00:00Added an answer on May 31, 2026 at 3:02 am

    The type of your digit is id, which is just basically just a C pointer to a certain struct. All references to objects in Objective-C have this primitive type, regardless of the Class of the object. So the answer to your question is, unfortunately, because that’s the way Objective-C works.

    So whether you’re declaring an NSString*, or an UITableViewController*, or MyClass*, your variable has type id. This is the primary means by which the language implements polymorphism. So, for example, the following declarations are equivalent:

    NSString *digit;
    id digit;
    

    And it’s true of method prototypes as well. These are equivalent:

    -(UITableViewCell *)tableView:(UITableView)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    -(id)tableView:(id)tableView cellForRowAtIndexPath:(id)indexPath;
    

    A variable of type id is not an object itself, it is a pointer to an object. It is the handle with which you manipulate an object. Objective-C does all of the class compatibility work at runtime.

    Hope this helps. Any questions?

    Updates

    That’s right: int, float, double, char, void, and the pointer combinations, are all C primitive types. You can and will still use these quite a bit, and they are just what they are in a C program. But Objective-C adds the id type as a way to bridge the gap between the primitive typing of C and the very high-level typing of objects by the Objective-C system. id itself is typedef’d as a pointer to a simple struct in objc.h. At the level of the compiler and the language itself, there really isn’t too much meaning to the type. For example, you’ll almost never declare an array of ids, certainly never perform any arithmetic with them.

    In fact, it’s not too far a stretch to say that Objective-C is just plain vanilla C with some added syntax (particularly, the square-bracket notation for method invocation), a few extra primitive types (id, IMP, SEL), and a big runtime library. It’s this runtime library that handles all things Object-Oriented.

    Anyway, to answer your question, when you’re actually programming, you will most often (99% of the time) just use class names to declare your variables – NSString *, NSData *, UITableViewController *, and so on. And the compiler will know what you’re talking about, and issue a warning if you write code that clearly tries to put an NSString* where an NSData* is expected. But the actual meaning of those types really exists only at runtime.

    I’ve digressed a little, but I’m not sure where your understanding is failing you, so I thought I’d just explain things a bit. You might want to read Apple’s The Objective-C Programming Language to get a feel for the language.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: objective c difference between id and void * While reading through NSZone.h
Possible Duplicate: objective c difference between id and void * For example, an UIView
Possible Duplicate: Is there a difference between YES/NO,TRUE/FALSE and true/false in objective-c? I have
Possible Duplicate: create multiple variables based on an int count Objective C Equivalent of
Possible Duplicate: Difference between class property mVar and instance variable self.mVar I am new
Possible Duplicate: Is there a difference between an instance variable and a property in
Possible Duplicate: Sha256 in Objective-C for iPhone Greetings, I'm having terrible trouble generating a
Possible Duplicate: Global int variable objective c I would like to create a global
Possible Duplicate: Writing into a file objective c How do I create and write
Possible Duplicate: Is there a difference between an "instance variable" and a "property" in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.