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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:11:29+00:00 2026-05-20T16:11:29+00:00

A while back I found that it’s possible to write a C++ function that

  • 0

A while back I found that it’s possible to write a C++ function that takes a parameter of function type (not function pointer type!). For example here’s a function that takes a callback function that accepts and returns a double:

void MyFunction(double function(double));

My question is what it means to have a variable of function type, since you can’t declare one in any other context. Semantically, how is it different from a function pointer or reference to a function? Is there an important difference between function pointers and variables of function type that I should be aware of?

  • 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-20T16:11:29+00:00Added an answer on May 20, 2026 at 4:11 pm

    Just like void f(int x[]) is the same as void f(int* x), the following two are identical:

    void MyFunction(double function(double)); 
    void MyFunction(double (*function)(double)); 
    

    Or, in official language (C++03 8.3.5/3), when determining the type of a function,

    After determining the type of each parameter, any parameter of type “array of T” or “function returning T” is adjusted to be “pointer to T” or “pointer to function returning T,” respectively.

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

Sidebar

Related Questions

A while back a found a great-looking framework that allowed .net developers to implement
A while back i found a website that would allow you to select a
UPDATED FOR CLARIFICATION I posted a similar question a while back found here which
A while back I found some code that allows you to filter the contents
A while back I created a lightbox plugin using jQuery that would load a
a while back, CNET had these really cool Social Share buttons, that when you
A while back I was playing with methods using variable-length argument lists (java) that
I little while back I posted this question . I have updated that question
This is an SQL efficiency question. A while back I had to write a
Back again with another rookie question. While working on a function for my homework

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.