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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:19:07+00:00 2026-05-13T22:19:07+00:00

i have googled and came to know that how to use the variable arguments.

  • 0

i have googled and came to know that how to use the variable arguments. but i want to pass my variable arguments to another method. i m getting errors. how to do that ?

-(void) aMethod:(NSString *) a, ... {
  [self anotherMethod:a]; 
  // i m doing this but getting error. how to pass complete vararg to anotherMethod
}
  • 1 1 Answer
  • 1 View
  • 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-13T22:19:08+00:00Added an answer on May 13, 2026 at 10:19 pm

    AFAIK ObjectiveC (just like C and C++) do not provide you with a syntax that allows what you directly have in mind.

    The usual workaround is to create two versions of a function. One that may be called directly using … and another one called by others functions passing the parameters in form of a va_list.

    ..
    [obj aMethod:@"test this %d parameter", 1337);
    [obj anotherMethod:@"test that %d parameter", 666);
    ..
    
    -(void) aMethod:(NSString *)a, ... 
    {
        va_list ap;
        va_start(ap, a);
    
        [self anotherMethod:a withParameters:ap]; 
    
        va_end(ap);
    }
    
    -(void) anotherMethod:(NSString *)a, ...
    {
        va_list ap;
        va_start(ap, a);
    
        [self anotherMethod:a withParameters:ap]; 
    
        va_end(ap);
    }
    
    -(void) anotherMethod:(NSString *)a withParameters:(va_list)valist 
    {
        NSLog([[[NSString alloc] initWithFormat:a arguments:valist] autorelease]);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've googled it, but came out empty. And the worst thing is that I
I have Googled a lot and found a lot of solutions, but none of
I have googled the topic for a while but haven't found what I'm looking
i have googled in the last 3 hours but i can't seem to find
I have Googled merge+cell+Javascript but did not find any suitable code to implement merge
I have googled an serached a lot here about background runnin aps but have
What I know: Rails has the cycle() method that enables odd/even rows in a
I came across a situation where I have to use Simulink. I have a
I want to launch iPhone Camera from web page. I googled around and came
I am getting this ambiguous reference error with some software that came from a

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.