answersLogoWhite

0


Best Answer

Function arrays are nothing more than arrays of function pointers so, besides the stddef header, you don't really need any libraries to implement a function array unless those functions use a type that isn't available in stddef.

#include<stddef.h>

void func_1() {} // obviously you must provide

void func_2() {} // implementations for these

void func_3() {} // functions

// a function array

void (*function_array[])() = { func_1, func_2, func_3 };

int main()

{

for(unsigned i=0; i<3; ++i)

function_array[i]; // call the function

}

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are commonly use libraries of c plus plus function arrays?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the Difference between arrays in c and c plus plus?

Nothing whatsoever. They are exactly the same.


What are libraries in C plus plus?

goo bah tazzy!


Array in c plus plus must be defined at compil time?

No. Arrays can be defined at runtime, just as they can in C. It's just that it's generally more convenient to use vectors instead of dynamic arrays at runtime, thus arrays are generally used statically, at compile time.


How do you use graphicsh in c plus plus?

With platform-dependent libraries.


Do you have pointer concept in c plus plus language?

Yes. All string variables are pointers as are other arrays.


What is the function of ctrl plus d?

The function of &lt;Ctrl&gt;D is to indicate "End of Transmission". It is the ASCII EOT code. Some run-time libraries and unix shells can use it when reading from standard input to signal the end of the message.


What is the difference between C plus plus and the D language?

D essentially evolved from practical usage of C++ and added features found in other languages including C#, Eiffel, Java, Python and Ruby. D has garbage collection, design by contract, unit testing, true modules, first class arrays, associative arrays, dynamic arrays, array slicing, nested functions, inner classes, closures, anonymous functions, compile time function execution, lazy evaluation, a re-engineered template syntax and integrated inline assembler.


What steps are required to locate math.h in C plus plus?

To find math.h, simply include it ... #include &lt;math.h&gt; ... The compiler knows where the standard libraries are. This is a function of where the compiler is installed, and varies from system to system. By using the carets (&lt; and &gt;) you are telling the compiler to look in the "standard" places.


How do you swap two arrays in c plus plus using string?

You can't. While a string is a character array, an array is not necessarily a string. Treating arrays as if they were strings simply to swap them is madness. The correct way to physically swap arrays A and B is to copy A to a new array, C, then copy B to A, then C to B. If the arrays are the same size this is not a problem. If they are different sizes, you can only swap them if they are dynamic (not static). This means you must reallocate them. To speed up the process, copy the smallest array to C, first. A much better approach would be to point at the two arrays and swap the pointers instead.


Is y plus x2 plus 1 a function?

That is not a function, although it does involve the function of addition. A function is something that is done to numbers.


What are the building function in c plus plus?

There is no such term as "building function" in C++.


A c plus plus statement that invokes a function is known as?

...a function call.