LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Why can't I use a pointer in an argument?

japp of course the pointer should be initialised correctly. Smiley Happy
0 Kudos
Message 11 of 15
(1,359 Views)
Hi Mikie,
   You've been working with this function for 20 years, so I suppose you was not using labWindows (i thing it came later...), so I'm wondering on which compiler did you use.... I knew that some old compilers were not strictly ANSI_C-compliant.  I'm just curious.... thanks for your replies!

Have a nice day!

Graziano
0 Kudos
Message 12 of 15
(1,340 Views)
I'd been using Microsoft C since the mid 80's.

For the last 10 years, it's been Microsoft Visual Studio C++.

Mike
0 Kudos
Message 13 of 15
(1,338 Views)
In addition to what everyone else said, I think the & identifier is only valid in c++, NOT in c.

Note that I say the & identifier, not the & operator. So you can call a function using foo(&a); which passes a pointer to a to the funtion foo by using the & operator in c. You can't use the & identifier in c as in the following example void foo(int &b);
0 Kudos
Message 14 of 15
(1,325 Views)
This sort of function definition:
 
int foobar(unsigned int a, int &b)
{
    // Acquire some data... then
    b = Data[a];
}
is OK in C++ (where & is used in this way as a call-by-reference indicator) but not in C. So if it worked before for you, it was most likely in a C++ environment, or using a C compiler that had C++-style extensions.
--
Martin
Certified CVI Developer
0 Kudos
Message 15 of 15
(1,298 Views)