In C/C++ <> is provided for arrays, however the other thing to remember is that it additionally dereferences pointers.

You are watching: Term does not evaluate to a function taking 1 arguments

So if you usage your function as miscellaneous like


Then values<0> will be 0, values<1> will be 1 and so on. Girlfriend don"t need to include the extra * to gain the worth out.

So your for loop would certainly be much more like


for (size_t ns = 0; ns if(values) > values) tempMax = values; else tempMax = *(values + 1); }

But also then this tho isn"t right. There are two troubles left, your variety will go right out of border on the last loop, and the else part will actually collection the tempMax to the value in values<1>. You likewise aren"t acquisition into consideration the present value of tempMax, so if the variety is 5, 4, 3, 2, 1, relying on how happy you room the worth in tempMax leaving the because that loop will certainly either it is in 1 or some weird number that you will have actually no idea just how it gained there. If ns was to write the function it would be an ext like.


int maximum(const int* values, size_t numValues) int tempMax = 0x80000000; //initialise come a low worth that you room going come get higher than //the value offered here is the lowest negative number the int deserve to store for (size_t i = 0; ns if(values > tmpMax) tempMax = values; //only update tempMax if the current value is bigger than tempMax return tempMax; }

The for condition of numValues - 1 will make certain we never ever go previous the end of the array. But this is assuming the your role is there to return the biggest number in the array.

This is a signatureAny samples offered are not supposed to have actually error checking or show ideal practices. They space meant to just show a point. I may likewise give inefficient password or present some difficulties to discourage copy/paste coding. This is due to the fact that the significant point of my write-ups is to help in the discovering process.Visit my (not an extremely good) blog athttp://ccprogramming.wordpress.com/
*

*

Are friend perhaps provided to making use of VB?

In VB arrays room done by using () but not in C/C++.

In C/C++ <> is supplied for arrays, but the various other thing to remember is the it additionally dereferences pointers.

So if you usage your function as other like


Then values<0> will certainly be 0, values<1> will certainly be 1 and also so on. Friend don"t need to include the extra * to acquire the value out.

So your for loop would be much more like


for (size_t ns = 0; i if(values) > values) tempMax = values; rather tempMax = *(values + 1); }

But even then this tho isn"t right. There room two difficulties left, your range will go ideal out of border on the last loop, and the else component will actually set the tempMax to the worth in values<1>. You also aren"t taking into factor to consider the current value that tempMax, therefore if the range is 5, 4, 3, 2, 1, relying on how lucky you room the worth in tempMax leave the for loop will certainly either it is in 1 or some weird number that you will have no idea just how it gained there. If i was to compose the role it would certainly be an ext like.

See more: At&Amp;T Your Account Needs Immediate Attention, At (Preposition) Definition And Synonyms


int maximum(const int* values, size_t numValues) int tempMax = 0x80000000; //initialise come a low value that you are going to get higher than //the value provided here is the lowest negative number that int have the right to store because that (size_t i = 0; ns if(values > tmpMax) tempMax = values; //only upgrade tempMax if the existing value is larger than tempMax return tempMax; }

The for problem of numValues - 1 will certainly make sure we never go previous the end of the array. However this is assuming that your function is over there to return the largest number in the array.

This is a signatureAny samples provided are not supposed to have error checking or show best practices. They room meant to just show a point. I may additionally give inefficient code or present some difficulties to discourage copy/paste coding. This is because the significant point that my short articles is to assist in the finding out process.Visit my (not really good) blog athttp://ccprogramming.wordpress.com/