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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:11:35+00:00 2026-06-09T00:11:35+00:00

I have found a strange as for me way to declare a method in

  • 0

I have found a strange as for me way to declare a method in Objective C.

Method declaration in .h file:

-(void)methodName:(NSString *)str, int i;

Method implementation in .m file:

-(void)methodName:(NSString *)str, int i
{
     NSLog(@"str = %@, int = %d", str, i);
}

I can call this method like this:

[self methodName:@"stringExample", 99];

And it would work fine.

My question is when should I use such syntax. Is there any difference between it and usual declaration?

  • 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-06-09T00:11:38+00:00Added an answer on June 9, 2026 at 12:11 am

    As described here, those parameters are optional:

    Methods that take a variable number of parameters are also possible,
    though they’re somewhat rare. Extra parameters are separated by commas
    after the end of the method name. (Unlike colons, the commas are not
    considered part of the name.) In the following example, the imaginary
    makeGroup: method is passed one required parameter (group) and three
    parameters that are optional:

    [receiver makeGroup:group, memberOne, memberTwo, memberThree];

    So yes, the declaration is different to the usual declaration. I cannot find any regular use of this type of declaration other than with a varargs method, where the optional parameter is declared as ....

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

Sidebar

Related Questions

I'm hacking my way through learning Flex and have found some strange behaviour. When
I have found what appears to be a strange bug with sqlite. I have
I experience a very strange problem and I don't have found any help to
during my debug sessions I found a strange thing occurring. I have an EditText
I have learn OpenGL programming for some time.And I found a very strange phenomenon
We have encountered a very strange class not found problem in our web app
I found a very interesting/strange thing about MAX() function in SQL. I have column
I found strange thing. For example I have Order and Item entity. Item is
I am facing a strange behavior by CakePHP 2.1: I have a method, $this->Time->getTime();
I have a strange file in my file system without the extension part. The

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.