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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:15:51+00:00 2026-06-02T02:15:51+00:00

I keep getting an error no instance of overloaded function printArray matches the argument

  • 0

I keep getting an error “no instance of overloaded function “printArray” matches the argument list. Will someone please tell me why? I’m trying to overload a template function so that it displays elements of an array starting and ending at specified positions.

I have my initial template and function:

template< typename T >
void printArray( const T *array, int count )

And the function that I’m trying to overload.

template< typename T >
void printArray(int lowSubscript, int highSubscript)

and my call:

// display elements 1-3 of array a
   cout << "Array a from positions 1 to 3 is:\n";
   elements = printArray(1,3);

my call for the first printArray shows no errors:

// display array a using original printArray function
   cout << "\nUsing original printArray function\n";
   printArray( a, ACOUNT );
  • 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-02T02:15:53+00:00Added an answer on June 2, 2026 at 2:15 am

    Your second overload of printArray is a template, but the signature is not dependent on the template parameter T. Therefore you must specify it when calling, e.g. printArray<int>(1,3).

    However, it is unclear which array is being printed: did you forget to add a parameter for the array, e.g. printArray(a,1,3)? In which case, you might be able to have T deduced from that parameter, as it is in the printArray(a,count) version.

    Also, the return type of void means you cannot write elements=printArray(1,3) even if the template parameter could be deduced.

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

Sidebar

Related Questions

I keep getting the following error: AttributeError: Caribou instance has no attribute 'on_key_up' The
I'm trying to code some stuff for a game but I keep getting error
Keep getting this error after inserting a subdatasheet into a query and trying to
I am trying to use a nested form but keep getting this error when
I keep getting this error Object reference not set to an instance of an
I am trying to run this program but i keep getting the error esent.h
I'm trying to iterate through an NSArray and keep getting a compiler error right
i keep getting this error message: Object reference not set to an instance of
I've been following a tutorial but keep getting the following error AttributeError: Worm instance
With the following code, I keep getting error C2535 when I compile. It's complaining

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.