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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:50:29+00:00 2026-06-09T21:50:29+00:00

ive seen functions passing pointers in their parameters and they are common in dynamic

  • 0

ive seen functions passing pointers in their parameters and they are common in dynamic use executing different functions after afew steps. However i came across this representation in a header file:

void *allocate_mem(u_int32_t n);

Any clue to how it is to be used? Is the function a pointer or does it return a pointer?

  • 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-09T21:50:31+00:00Added an answer on June 9, 2026 at 9:50 pm

    See my comments.

    Please use cdecl.org whenever you have questions like this… entering void *allocate_mem(u_int32_t), we get the following.

    declare allocate_mem as function (u_int32_t) returning pointer to void.

    So, we know allocate_mem returns void *. Now, you’re probably wondering why you would ever want a pointer to void…

    §6.3.2.3.1 of the C99 standard states as follows.

    A pointer to void may be converted to or from a pointer to any incomplete or object type. A pointer to any incomplete or object type may be converted to a pointer to void and back again; the result shall compare equal to the original pointer.

    Thus you can convert the result of allocate_mem to fit your needs, e.g.

    float *data = allocate_mem(1024 * sizeof(float))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've seen different developers include semicolons after functions in javascript and some haven't. Which
Is there a common standard for reporting errors in your class functions? I've seen
I've seen this tag used after javascript functions for over a decade now and
In Numerical Recipes they use something I've never seen done before, and couldn't easily
CakePHP makes heavy use of associative arrays for passing large numbers of parameters to
I've seen some developers use the out keyword on parameter lists of void functions.
When using the profiler in Visual Studio to track down expensive functions, I've seen
I've seen the following (bizarre) Javascript rounding function in some legacy code. After googling
I've seen some code where they just do this: $().ready(function() { ... }); This
It is not the first time i see it Ive seen in Facebook source

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.