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

  • Home
  • SEARCH
  • 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
  • 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-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 have checked the whole site and googled on the net but was unable
What I know: Rails has the cycle() method that enables odd/even rows in a
I'm getting my first experience with Oracle and TOAD (I know SSMS). I came
I have googled around and not seen any info. What format and icon color
I'm at wits end now, I have googled this to death and found nothing.
I have already googled for this I have a Table with following structure in
Outline OK, I have Google'd this and already expecting a big fat NO!! But
I have a Google Map that suddenly stopped working for no apparent reason (I
I have a simple Google App Engine app, that I wrote using ordinary strings.
Does anybody know a minimalistic, nice-looking visitor statistics suite based on PHP that displays

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.