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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:49:45+00:00 2026-05-14T19:49:45+00:00

Why and how does dereferencing a function pointer just do nothing? This is what

  • 0

Why and how does dereferencing a function pointer just “do nothing”?

This is what I am talking about:

#include<stdio.h>

void hello() { printf("hello"); }

int main(void) { 
    (*****hello)(); 
}

From a comment over here:

function pointers dereference just
fine, but the resulting function
designator will be immediately
converted back to a function pointer


And from an answer here:

Dereferencing (in way you think) a
function’s pointer means: accessing a
CODE memory as it would be a DATA
memory.

Function pointer isn’t suppose to be
dereferenced in that way. Instead, it
is called.

I would use a name “dereference” side
by side with “call”. It’s OK.

Anyway: C is designed in such a way
that both function name identifier as
well as variable holding function’s
pointer mean the same: address to CODE
memory. And it allows to jump to that
memory by using call () syntax either
on an identifier or variable.


How exactly does dereferencing of a function pointer work?

  • 1 1 Answer
  • 2 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-14T19:49:46+00:00Added an answer on May 14, 2026 at 7:49 pm

    It’s not quite the right question. For C, at least, the right question is

    What happens to a function value in an rvalue context?

    (An rvalue context is anywhere a name or other reference appears where it should be used as a value, rather than a location — basically anywhere except on the left-hand side of an assignment. The name itself comes from the right-hand side of an assignment.)

    OK, so what happens to a function value in an rvalue context? It is immediately and implicitly converted to a pointer to the original function value. If you dereference that pointer with *, you get the same function value back again, which is immediately and implicitly converted into a pointer. And you can do this as many times as you like.

    Two similar experiments you can try:

    • What happens if you dereference a function pointer in an lvalue context—the left-hand side of an assignment. (The answer will be about what you expect, if you keep in mind that functions are immutable.)

    • An array value is also converted to a pointer in an lvalue context, but it is converted to a pointer to the element type, not to a pointer to the array. Dereferencing it will therefore give you an element, not an array, and the madness you show doesn’t occur.

    Hope this helps.

    P.S. As to why a function value is implicitly converted to a pointer, the answer is that for those of us who use function pointers, it’s a great convenience not to have to use &‘s everywhere. There’s a dual convenience as well: a function pointer in call position is automatically converted to a function value, so you don’t have to write * to call through a function pointer.

    P.P.S. Unlike C functions, C++ functions can be overloaded, and I’m not qualified to comment on how the semantics works in C++.

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

Sidebar

Ask A Question

Stats

  • Questions 515k
  • Answers 515k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer At any given time, Given the original real part, the… May 16, 2026 at 6:24 pm
  • Editorial Team
    Editorial Team added an answer Use array slices: #! /usr/bin/perl use warnings; use strict; my… May 16, 2026 at 6:24 pm
  • Editorial Team
    Editorial Team added an answer That would definitely work. I'd asked a question in the… May 16, 2026 at 6:23 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Possible Duplicate: How does dereferencing of a function pointer happen? Hi All, Why these
I'm just learning c++, and coming from c, some function calls I'm seeing in
Does the FB Like button work in email newsletters? Or will this only be
Does anyone know any good chart api for a web application in java? This
I would like to pass some (dll or not) function pointers as arguments to
When a C++ function accepts an std::vector argument, the usual pattern is to pass
The codebase at work contains some code that looks roughly like this: #define DATA_LENGTH
I'm trying to create the following data structure in Qt 4.5 in C++: QMap<int,
Just getting into C++. I'm getting constantly thrown off track when I see the
Does Ehcache 2.1 now support the transactional cache concurrency strategy in Hibernate 3.3.2GA? That

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.