hey,
i just read about passing arrays to functions in C++ like this
function modifyArray(arrayname, arraysize); i need help with sending an array and another variable to a function... since the array size is an integer and the second integer is also going to be in the argument... i dont know which variable will follow the array name.. is it the array size or the second variable i am willing to pass to the fuction as well:-O:-/

Recommended Answers

All 2 Replies

It depends on the function you're calling. It could be defined as void foo(T* someArray, int arraySize, int otherValue) or as void foo(T* someArray, int otherValue, int arraySize) . The second one sucks, but you'll just have to check.

the fuction i am calling is to search an array for a number, the number i am to search for is to be passed as an arguement

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.