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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:49:34+00:00 2026-05-16T03:49:34+00:00

The code states: void (* log_msg)(char *msg) =printf; void change_and_log(int *buffer, int offset, int

  • 0

The code states:

void (* log_msg)(char *msg)
    =printf;

void change_and_log(int *buffer, int offset, int value){
    buffer[offset] = value;
    log_msg("changed");
}

I’m most concerned with the first part:

Firstly, what does the signature void (* log_msg)(char *msg) mean? Is this code simply mapping the function log_msg to printf? In that case, why is the function name (* log_msg) and not simply log_msg?

  • 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-16T03:49:35+00:00Added an answer on May 16, 2026 at 3:49 am

    It’s a function pointer.

    The type of a function pointer is R (*)(Args...), where R and Args... are replaced with the return type and arguments, if any. It is read as “a pointer to a function that takes arguments Args... and returns R.”

    Your code would read easier as:

    // print_function is a type that is a function pointer
    typedef void (*print_function)(char *msg); 
    
    // log_msg is a variable of the type print_function: it points to a function
    print_function log_msg = printf; // point to printf
    

    And later, it’s just calling that function via a function pointer.

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

Sidebar

Ask A Question

Stats

  • Questions 509k
  • Answers 509k
  • 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 "diff output amidst all of these files while offline?": it… May 16, 2026 at 4:40 pm
  • Editorial Team
    Editorial Team added an answer You can use ContentStart or ContentEnd to get a TextPointer… May 16, 2026 at 4:40 pm
  • Editorial Team
    Editorial Team added an answer All classes derived from the class template CDataAndEvent<T> including CAcceptor… May 16, 2026 at 4:40 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

I'm trying to do some Socket programming in Java, and I'm using the BufferedStreamReader.read(char[])
Eclipse is marking findViewById(int) as undefined; it was doing the same thing for getResources(),
I have some code that receives some XML and there is the possibility that
public class People { // Code to create a random set of people omitted
Using the System.DirectoryServices.Protocols namespace to add/modify attributes on an Active Directory group. Code: public
In the following code you'll see a simple lexer that conforms to the following
I have a content observer that polls content://sms/ in android 1.5 so that I
I have a Java program that processes one file at a time. This Java
I've looked hard for duplicates but have to ask the following, no matter how
I currently have a Service in Android that is a sample VOIP client so

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.