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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:59:46+00:00 2026-06-10T10:59:46+00:00

It’s interesting that using the function name as a function pointer is equivalent to

  • 0

It’s interesting that using the function name as a function pointer is equivalent to applying the address-of operator to the function name!

Here’s the example.

typedef bool (*FunType)(int);
bool f(int);
int main() {
  FunType a = f;
  FunType b = &a; // Sure, here's an error.
  FunType c = &f; // This is not an error, though. 
                  // It's equivalent to the statement without "&".
                  // So we have c equals a.
  return 0;
}

Using the name is something we already know in array. But you can’t write something like

int a[2];
int * b = &a; // Error!

It seems not consistent with other parts of the language. What’s the rationale of this design?

This question explains the semantics of such behavior and why it works. But I’m interested in why the language was designed this way.

What’s more interesting is the function type can be implicitly converted to pointer to itself when using as a parameter, but will not be converted to a pointer to itself when using as a return type!

Example:

typedef bool FunctionType(int);
void g(FunctionType); // Implicitly converted to void g(FunctionType *).
FunctionType h(); // Error!
FunctionType * j(); // Return a function pointer to a function 
                    // that has the type of bool(int).
  • 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-10T10:59:47+00:00Added an answer on June 10, 2026 at 10:59 am

    Since you specifically ask for the rationale of this behavior, here’s the closest thing I can find (from the ANSI C90 Rationale document – http://www.lysator.liu.se/c/rat/c3.html#3-3-2-2):

    3.3.2.2 Function calls

    Pointers to functions may be used either as (*pf)() or as pf().
    The latter construct, not sanctioned in the Base Document, appears in
    some present versions of C, is unambiguous, invalidates no old code,
    and can be an important shorthand. The shorthand is useful for
    packages that present only one external name, which designates a
    structure full of pointers to object s and functions : member
    functions can be called as graphics.open(file) instead of
    (*graphics.open)(file). The treatment of function designators can
    lead to some curious , but valid , syntactic forms . Given the
    declarations :

    int f ( ) , ( *pf ) ( ) ; 
    

    then all of the following expressions are valid function calls :

    ( &f)(); f(); (*f)(); (**f)(); (***f)();
    pf(); (*pf)(); (**pf)(); (***pf)();
    

    The first expression on each line was discussed in the previous
    paragraph . The second is conventional usage . All subsequent
    expressions take advantage of the implicit conversion of a function
    designator to a pointer value , in nearly all expression contexts .
    The Committee saw no real harm in allowing these forms ; outlawing
    forms like (*f)(), while still permitting *a (for int a[]),
    simply seemed more trouble than it was worth .

    Basically, the equivalence between function designators and function pointers was added to make using function pointers a little more convenient.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

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.