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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:46:25+00:00 2026-05-31T04:46:25+00:00

In the parameter’s of a function, I want to pass a default argument that

  • 0

In the parameter’s of a function, I want to pass a default argument that is a function template. What I’m trying to decipher is the difference between (*cmp) or (cmp) in the function below:

template <typename Type>
int Foo(some var, int (*cmp)(Type one, Type two) = FunctTemplate) { ...

I am used to seeing the * as a pointer declaration… Is this a pointer to the function FunctTemplate? Why does the program see to work regardless of way I write it (astrik or no astrik)?

  • 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-31T04:46:26+00:00Added an answer on May 31, 2026 at 4:46 am

    The types are not the same, but there is no difference when they are used as a parameter type in a function declaration.

    In int (*cmp)(Type, Type), cmp has pointer-to-function type (or a “function pointer” type).

    In int (cmp)(Type, Type), cmp has function type (i.e., it is not a pointer type at all).

    However, C and C++ both have a rule that any parameter that has a function type is implicitly converted to the corresponding function pointer type, just as any parameter that has an array type is implicitly converted to the corresponding pointer type.

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

Sidebar

Related Questions

Is there a parameter I can pass to https://www.facebook.com/dialog/oauth that will force the user
I wanna pass parameter to Custom View at runtime. is that possible? <custom.analog.clock.AnalogClock1 android:id=@+id/clock
Is there any parameter/function in JS that tells you if an element was closed
Difference between value parameter and reference parameter ? This question is asked sometime by
The only SET parameter that I have found specific guidance for is SET TRANSACTION
When defining parameter type that is e.g. in System.Data you have no intellisense and
I'm passing as parameter an id to a javascript function, because it comes from
My method has a parameter, I have to use that in my For loop
is there any parameter i can set in hibernate so that temporary not allow
Like the parameter in ISNULL function? Something we can use to define: create function

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.