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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:54:52+00:00 2026-06-08T09:54:52+00:00

I am using a code written by somebody else, where they intend to use

  • 0

I am using a code written by somebody else, where they intend to use a function pointer. They do a very strange typdef that I can not understand. Below the code

typedef void (myType)(void);
typedef myType *myTypePtr;

I can understand that the main idea with myTypePtr is to create a “pointer to a function that receives void and returns void. But what about the original myType? What is that? a function type? Is not clear to me.

Furthermore, later there is this function prototype

int createData(int id,int *initInfo, myTypePtr startAddress)

However I get the compile error “expected declaration specifiers or ‘…’ before ‘myTypePtr’ any idea why this is happening?. Thank you very much.

  • 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-08T09:54:53+00:00Added an answer on June 8, 2026 at 9:54 am

    This first typedef

    typedef void (myType)(void);
    

    provides myType as a synonym for the type void (void), the type of a function that takes no arguments and returns void. The parentheses around myType aren’t actually necessary here; you could also write

    typedef void myType(void);
    

    to make it clearer that it’s the type of a function that takes void and returns void. Note that you can’t actually declare any variables of function type; the only way to get an object of function type in C is to define an actual function.

    The second typedef

    typedef myType *myTypePtr;
    

    then says that myTypePtr has a type that’s equal to a pointer to a myType, which means that it’s a pointer to a function that takes no arguments and returns void. This new type is equivalent to the type void (*)(void), but is done a bit indirectly.

    As for your second error, I can’t say for certain what’s up without more context. Please post a minimal test case so that we can see what’s causing the error.

    Hope this helps!

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

Sidebar

Related Questions

Can somebody help me in converting the following code written using if-else to try/catch.
There is some code that I am using written by someone else that I
I'm experimenting with Application.AddMessageFilter , using some code written originally by Somebody Else, so
I have written some code that loads an XML document using an XmlDocument object
I need to compile some mfc code that was written using Visual C++ 6.0
I'm working on an old site, written by somebody else, and they've done something
Please, may somebody explain me, what can raise an exception in this code? function
I am using InfoPath 2007 I have some code written in the form that
Is there any tool that might help in converting the Java code written using
I've written some code using the REST starter kit and it works fine on

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.