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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:24:07+00:00 2026-06-09T20:24:07+00:00

I am trying to chain together a few overloaded functions. It is something that

  • 0

I am trying to chain together a few overloaded functions. It is something that should be really simple but I am getting errors. Here is the code:

void output(char c[])
{
    output(c, 0);
}

void output(char c[], int x)
{
    int l = strlen(c) - x;
    output(c, x, l);
}

void output(char c[], int x, int y)
{
    cout << c;
}

int main()
{
    output("myname");
    output("myname", 3);
    output("myname", 2, 4);
}

The errors I am getting relate the chained parts (output(c, 0); and output(c, x, l);.
The errors are:

"No matching function for call to 'output (char *&, int)'
"No matching function for call to 'output (char *&, int &, int &)'

An explanation of what I have done wrong would be good as well.

  • 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-09T20:24:09+00:00Added an answer on June 9, 2026 at 8:24 pm

    I think the problem has to do with the fact that your functions lack prototypes. In cases like that, you should re-order functions so that the ones you call appear ahead of the ones that call them:

    void output(const char c[], int x, int y)
    {
        cout << c;
    }
    void output(const char c[], int x)
    {
        int l = strlen(c) - x;
        output(c, x, l);
    } 
    void output(const char c[])
    {
        output(c, 0);
    }
    

    But it is best to stick to using prototypes for all functions ahead of defining them.

    Also note that string literals are const. Since your functions do not modify the content of string literals, you should declare const char c[] instead of char c[].

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

Sidebar

Related Questions

I have a number of dropdown lists that I'm trying to chain together and
I'm trying to connect to https url - https://rtpubcommission.api.cj.com/wsdl/version2/realtimeCommissionServiceV2.wsdl But getting the errors (listed
I am trying to setup my swap chain Buffer but I get the following
I'm trying to build a rather longwinded chain of programs and libraries that culminates
I'm trying to organize filter chain of EventQueue.dispatchEvent . Something like java.io.FilterInputStream or javax.servlet.Filter
I am trying to chain multiple compiled linq queries together. I have succeeded in
For the sake of learning, I'm trying to chain decorators that are defined by
I am trying to set up a build chain that propagates a modification history
We're having an issue trying to chain selectors together. We are trying to get
I have a view joining 3 tables together in a chain that i need

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.