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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:18:54+00:00 2026-06-11T11:18:54+00:00

From Objective C Programming Guide (Under the "Object Messaging" section), Methods that take a

  • 0

From Objective C Programming Guide (Under the "Object Messaging" section),

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];

I tried to create such a method and it shows an error

"Expected ‘;’ after method prototype"

when I try to declare the below function in my interface file(.h file).

- (void) printMyClass: (int) x, (int) y, (int) z;

Can anyone give sample example to create such a method like makeGroup

Thank you

  • 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-11T11:18:55+00:00Added an answer on June 11, 2026 at 11:18 am

    You can see this link.

    In your header file define the methods with three dots at the end

    -(void)yourMethods:(id)string1,...;
    

    And in you implementation file write the methods body

    -(void)yourMethods:(id)string1, ...{
    
        NSMutableArray *arguments=[[NSMutableArray alloc]initWithArray:nil];
        id eachObject;
        va_list argumentList;
        if (string1) 
        {
            [arguments addObject: string1];
            va_start(argumentList, string1); 
            while ((eachObject = va_arg(argumentList, id)))    
            {
                 [arguments addObject: eachObject];
            }
            va_end(argumentList);        
         }
        NSLog(@"%@",arguments);
    }
    

    Now call your method

    [self yourMethods:@"ab",@"cd",@"ef",@"gf",nil];
    

    NOTE: remember to put nil at the end

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

Sidebar

Related Questions

This is an example from The Objective-C 2.0 Programming Language. I was just wondering,
Per the Core Data Programming Guide: You can specify that an attribute is optional—that
I'm really new to programming with objective c and so I hope that you
(programming in iPhone objective-C) I have a class level NSString* that I create, add
I'm programming on objective-c. I've removed all files from MyTarget -> Build Phases ->
I'm working through a challenge in Objective-C Programming, The Big Nerd Ranch Guide, and
I'm doing some Objective-C programming that involves parsing an NSXmlDocument and populating an objects
I know Objective-C from Desktop Apple Programming. But i want to jump on the
From the Core Data Programming Guide (my emphasis): By default, Core Data dynamically creates
I am making a fraction calculator app from the Programming In Objective-C 2.0 book.

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.