Re: Newbie Convert int to int * ???
- From: mark <mark@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 5 Apr 2007 13:56:06 -0700
Thank you.
Your & worked!
The fact is, (dare I say it) I code in VB.NET. We don't worry about this
stuff.
I was forced back into the C++ world by a set of valuable functions (in C++)
that I want to translate into VB. (I needed to see data flow patterns in the
original implementations to be certain I was properly recoding.)
Long ago I coded in Borland C++., and yes I have forgoton so much. But I
don't miss it. Not having to count out every meter, I can now write an epic
poem.
But all that pomp and circumstance associated with C has charm doesn't it?
Perhaps I re-translate back into C sharp when I'm done.
--
mark b
"Carl Daniel [VC++ MVP]" wrote:
"mark" <mark@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message.
news:17F3A5E7-EA3B-4B88-9C85-942F30C0F3BB@xxxxxxxxxxxxxxxx
I have a sub:
void cdff ( int *m, double *p) {blah; blah;}
Fine, your function expects a pointer to int and a pointer to double -
presumably so that it can modify the variables passed to it.
Later, I call it:
private: System::Void button1_Click(System::Object^ sender,
System::EventArgs^ e) {
int m = 1;
double p = 2.3;
cdff (m, p);
Here, you're passing an int and a double, which isn't what the function
expected.
change it to
cdff(&m,&p);
blah; blah;
}
I get the error C2664 : cannot convert parameter 1 from 'int' to 'int *'
What is happening and how can I get the values 1 and 2.3 in a form that is
compatible with the function?
You need to brush up on (or learn for the first time) basic principles of
values and pointers in C (or C++). I'd suggest Googling for "Thinking in
C++". It's an online e-book that's free and will answer this and many other
questions.
-cd
- References:
- Re: Newbie Convert int to int * ???
- From: Carl Daniel [VC++ MVP]
- Re: Newbie Convert int to int * ???
- Prev by Date: Re: Registry Access (Write Access)
- Next by Date: Re: Registry Access (Write Access)
- Previous by thread: Re: Newbie Convert int to int * ???
- Index(es):
Relevant Pages
|