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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:41:25+00:00 2026-06-03T22:41:25+00:00

Can you please explain the error from following code please: void foo(void*& param) {

  • 0

Can you please explain the error from following code please:

void foo(void*& param)
{
    param = new char[10];
}

void main()
{
    int* p;
    foo(p);
}

error C2664: 'foo' : cannot convert parameter 1 from 'int *' to 'void *&'

How may I call a function with any pointer type and change that pointer inside the function(not the value at that address, the address itself). I don’t want to use templates or double pointers.

  • 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-03T22:41:26+00:00Added an answer on June 3, 2026 at 10:41 pm

    Why can you not pass an int* as argument to f?

    The problem is that if that was allowed you would be breaking the type system. Which to be honest is exactly what you are trying to do… If you want to break the type system you will need to explicitly request it by means of a cast.

    You point out in a comment that you don’t want to use casts, on the other hand the compiler does not want you to break the type system. In that battle of wills, I don’t think you are going to convince the compiler… it is just too stubborn.

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

Sidebar

Related Questions

Can someone please explain why I'm getting this error Type mismatch: cannot convert from
Can someone please explain how to understand a logcat from an android force close.
Can anyone please explain to me why the following two queries yield different results?
Can someone please explain why this code is not outputting a value for $consultant
Can someone please explain to me why I keep getting this PLS-00905 error for
Can someone please explain to me the meaning of the following warnings when running
Can somebody please explain how to use macros in x86 assembly coding
Can someone please explain to me the difference between the AppSettings and ApplicationSettings sections
Can anyone please explain me what is DataContractTranslstor and what's it's use?
Can someone please explain the major differences between Scala, Groovy and Clojure. I know

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.