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 5996861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:10:58+00:00 2026-05-23T00:10:58+00:00

Possible Duplicate: Why passing &error instead of error in Cocoa programming? I have a

  • 0

Possible Duplicate:
Why passing &error instead of error in Cocoa programming?

I have a question for which I cannot seem to find an answer…

I am using the SBJsonParser and there is a line of code I find puzzling:

NSError *error;
self.jsonData = [jsonParser objectWithString:responseString error:&error];

What is the & in front of the error parameter? (&error)?

  • 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-23T00:10:59+00:00Added an answer on May 23, 2026 at 12:10 am

    In Objective-C, just like in C, & is the “address-of operator” and it returns the address of its argument. To find out more about it, I recommend you read this short chapter from The C Book.

    Here’s an example of how the operator is used, to get a better idea:

    #include <stdio.h>
    
    // define a function that takes a pointer to an integer as argument
    void change_value_of_int(int* int_to_change) {
        // change the value to which the argument points
        *int_to_change = 5;
    }
    
    int main() {
        // create a stack variable
        int test_int = 10;
    
        // pass the address of test_int to the function defined earlier
        change_value_of_int(&test_int);
    
        // now the value of test_int is 5
        printf("%d\n", test_int);
    
        return 0;
    }
    

    Note that the change_value_of_int() function expects the first parameter to be a pointer to an int, not an int, so you can’t call it with change_value_of_int(test_int). You must send it the address of the test_int variable, not the variable itself (because if you send a copy of the variable, it can’t change it).

    Same thing with the NSError* example. jsonParser expects the address of a NSError*, not a NSError*, therefore the method is defined as:

    - (id)objectWithString:(NSString*)jsonrep error:(NSError**)error;
    

    Take a look at the header file and at the implementation to see how it is used. The value of your error (*error = the value of the thing pointed to by the error argument) becomes the return value of [errorTrace lastObject].

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

Sidebar

Related Questions

Possible Duplicate: C#: Passing null to overloaded method - which method is called? Here
Possible Duplicate: Passing arguments to JAR which is required by Java Interpreter how to
Possible Duplicate: NAnt or MSBuild, which one to choose and when? What is the
Possible Duplicate: How does the Google Did you mean? Algorithm work? Suppose you have
Possible Duplicate: Pre & post increment operator behavior in C, C++, Java, & C#
Possible Duplicate: C++ passing variables in from one Function to the Next. The Program
Possible Duplicate: Default value to a parameter while passing by reference in C++ Is
Possible Duplicate: Passing varible types though mod-rewrite howdy, I'm using the get method on
Possible Duplicate: In PHP (>= 5.0), is passing by reference faster? I wonder if
Possible Duplicate: Why am I getting Undefined index from my PHP? $pattern2 = /([A-Za-z0-9\.\-\_\!\#\$\%\&\'\*\+\/\=\?\^\`\{\|\}]+)\@([A-Za-z0-9.-_]+)(\.[A-Za-z]{2,5})/;

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.